GDTCORUploader.h 1.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. * Copyright 2018 Google
  3. *
  4. * Licensed under the Apache License, Version 2.0 (the "License");
  5. * you may not use this file except in compliance with the License.
  6. * You may obtain a copy of the License at
  7. *
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. *
  10. * Unless required by applicable law or agreed to in writing, software
  11. * distributed under the License is distributed on an "AS IS" BASIS,
  12. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. * See the License for the specific language governing permissions and
  14. * limitations under the License.
  15. */
  16. #import <Foundation/Foundation.h>
  17. #import <GoogleDataTransport/GDTCORClock.h>
  18. #import <GoogleDataTransport/GDTCORLifecycle.h>
  19. #import <GoogleDataTransport/GDTCORPrioritizer.h>
  20. #import <GoogleDataTransport/GDTCORTargets.h>
  21. #import <GoogleDataTransport/GDTCORUploadPackage.h>
  22. NS_ASSUME_NONNULL_BEGIN
  23. /** This protocol defines the common interface for uploader implementations. */
  24. @protocol GDTCORUploader <NSObject, GDTCORLifecycleProtocol, GDTCORUploadPackageProtocol>
  25. @required
  26. /** Returns YES if the uploader can make an upload attempt, NO otherwise.
  27. *
  28. * @param target The target being checked.
  29. * @param conditions The conditions that the upload attempt is likely to occur under.
  30. * @return YES if the uploader can make an upload attempt, NO otherwise.
  31. */
  32. - (BOOL)readyToUploadTarget:(GDTCORTarget)target conditions:(GDTCORUploadConditions)conditions;
  33. /** Uploads events to the backend using this specific backend's chosen format.
  34. *
  35. * @param package The event package to upload. Make sure to call -completeDelivery.
  36. */
  37. - (void)uploadPackage:(GDTCORUploadPackage *)package;
  38. @end
  39. NS_ASSUME_NONNULL_END