GTLRBatchQuery.h 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485
  1. /* Copyright (c) 2011 Google Inc.
  2. *
  3. * Licensed under the Apache License, Version 2.0 (the "License");
  4. * you may not use this file except in compliance with the License.
  5. * You may obtain a copy of the License at
  6. *
  7. * http://www.apache.org/licenses/LICENSE-2.0
  8. *
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. // Batch query documentation:
  16. // https://github.com/google/google-api-objectivec-client-for-rest/blob/main/USING.md#batch-operations
  17. #import "GTLRQuery.h"
  18. NS_ASSUME_NONNULL_BEGIN
  19. @interface GTLRBatchQuery : NSObject <GTLRQueryProtocol>
  20. /**
  21. * Queries included in this batch. Each query should have a unique @c requestID.
  22. */
  23. @property(atomic, copy, nullable) NSArray<GTLRQuery *> *queries;
  24. /**
  25. * Flag indicating if query execution should skip authorization. Defaults to NO.
  26. */
  27. @property(atomic, assign) BOOL shouldSkipAuthorization;
  28. /**
  29. * Any additional HTTP headers for this batch.
  30. *
  31. * These headers override the same keys from the service object's
  32. * @c additionalHTTPHeaders.
  33. */
  34. @property(atomic, copy, nullable) NSDictionary<NSString *, NSString *> *additionalHTTPHeaders;
  35. /**
  36. * Any additional URL query parameters to add to the batch query.
  37. *
  38. * These query parameters override the same keys from the service object's
  39. * @c additionalURLQueryParameters
  40. */
  41. @property(atomic, copy, nullable) NSDictionary<NSString *, NSString *> *additionalURLQueryParameters;
  42. /**
  43. * The batch request multipart boundary, once determined.
  44. */
  45. @property(atomic, copy, nullable) NSString *boundary;
  46. /**
  47. * The brief string to identify this query in @c GTMSessionFetcher http logs.
  48. *
  49. * The default logging name for batch requests includes the API method names.
  50. */
  51. @property(atomic, copy, nullable) NSString *loggingName;
  52. /**
  53. * Constructor for a batch query, for use with @c addQuery:
  54. */
  55. + (instancetype)batchQuery;
  56. /**
  57. * Constructor for a batch query, from an array of @c GTLRQuery objects.
  58. */
  59. + (instancetype)batchQueryWithQueries:(NSArray<GTLRQuery *> *)array;
  60. /**
  61. * Add a single @c GTLRQuery to the batch.
  62. */
  63. - (void)addQuery:(GTLRQuery *)query;
  64. /**
  65. * Search the batch for a query with the specified ID.
  66. */
  67. - (nullable GTLRQuery *)queryForRequestID:(NSString *)requestID;
  68. @end
  69. NS_ASSUME_NONNULL_END