GTLRURITemplate.h 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /* Copyright (c) 2010 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. #import <Foundation/Foundation.h>
  16. #ifndef SKIP_GTLR_DEFINES
  17. #import "GTLRDefines.h"
  18. #endif
  19. NS_ASSUME_NONNULL_BEGIN
  20. //
  21. // URI Template
  22. //
  23. // http://tools.ietf.org/html/draft-gregorio-uritemplate-04
  24. //
  25. // NOTE: This implemention is only a subset of the spec. It should be able
  26. // to parse any tempate that matches the spec, but if the template makes use
  27. // of a feature that is not supported, it will fail with an error.
  28. //
  29. @interface GTLRURITemplate : NSObject
  30. // Process the template. If the template uses an unsupported feature, it will
  31. // throw an exception to help catch that limitation. Currently unsupported
  32. // feature is partial result modifiers (prefix/suffix).
  33. //
  34. // valueProvider should be anything that implements -objectForKey:. At the
  35. // simplest level, this can be an NSDictionary. However, a custom class that
  36. // implements valueForKey my be better for some uses.
  37. + (NSString *)expandTemplate:(NSString *)URITemplate
  38. values:(NSDictionary *)valueProvider;
  39. @end
  40. NS_ASSUME_NONNULL_END