/core/externals/update-engine/externals/gdata-objectivec-client/Source/Clients/YouTube/GDataQueryYouTube.m

http://macfuse.googlecode.com/ · Objective C · 173 lines · 118 code · 36 blank · 19 comment · 1 complexity · 9556612ed59e7d3d580c4899e597b0e6 MD5 · raw file

  1. /* Copyright (c) 2008 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. //
  16. // GDataQueryYouTube.m
  17. //
  18. #if !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE
  19. #define GDATAQUERYYOUTUBE_DEFINE_GLOBALS 1
  20. #import "GDataQueryYouTube.h"
  21. #import "GDataServiceGoogleYouTube.h"
  22. static NSString *const kTimeParamName = @"time";
  23. static NSString *const kFormatParamName = @"format";
  24. static NSString *const kCaptionTrackFormatParamName = @"fmt";
  25. static NSString *const kSafeSearchParamName = @"safeSearch";
  26. static NSString *const kRestrictionParamName = @"restriction";
  27. static NSString *const kLanguageRestrictionParamName = @"lr";
  28. static NSString *const kLocationParamName = @"location";
  29. static NSString *const kLocationRadiusParamName = @"location-radius";
  30. static NSString *const kCaptionParamName = @"caption";
  31. static NSString *const k3DParamName = @"3d";
  32. static NSString *const kInlineParamName = @"inline";
  33. static NSString *const kUploaderParamName = @"uploader";
  34. @implementation GDataQueryYouTube
  35. + (GDataQueryYouTube *)youTubeQueryWithFeedURL:(NSURL *)feedURL {
  36. return [self queryWithFeedURL:feedURL];
  37. }
  38. - (void)setVideoQuery:(NSString *)str {
  39. // The vq query parameter has been replaced with
  40. // "q" (kFullTextQueryStringParamName) for v2
  41. [self setFullTextQueryString:str];
  42. }
  43. - (NSString *)videoQuery {
  44. return [self fullTextQueryString];
  45. }
  46. - (void)setFormat:(NSString *)str {
  47. [self addCustomParameterWithName:kFormatParamName
  48. value:str];
  49. }
  50. - (NSString *)format {
  51. return [self valueForParameterWithName:kFormatParamName];
  52. }
  53. - (void)setCaptionTrackFormat:(NSString *)str {
  54. [self addCustomParameterWithName:kCaptionTrackFormatParamName
  55. value:str];
  56. }
  57. - (NSString *)captionTrackFormat {
  58. return [self valueForParameterWithName:kCaptionTrackFormatParamName];
  59. }
  60. - (void)setTimePeriod:(NSString *)str {
  61. [self addCustomParameterWithName:kTimeParamName
  62. value:str];
  63. }
  64. - (NSString *)timePeriod {
  65. return [self valueForParameterWithName:kTimeParamName];
  66. }
  67. - (void)setRestriction:(NSString *)str {
  68. [self addCustomParameterWithName:kRestrictionParamName
  69. value:str];
  70. }
  71. - (NSString *)restriction {
  72. return [self valueForParameterWithName:kRestrictionParamName];
  73. }
  74. - (void)setLanguageRestriction:(NSString *)str {
  75. [self addCustomParameterWithName:kLanguageRestrictionParamName
  76. value:str];
  77. }
  78. - (NSString *)languageRestriction {
  79. return [self valueForParameterWithName:kLanguageRestrictionParamName];
  80. }
  81. - (void)setLocation:(NSString *)str {
  82. [self addCustomParameterWithName:kLocationParamName
  83. value:str];
  84. }
  85. - (NSString *)location {
  86. return [self valueForParameterWithName:kLocationParamName];
  87. }
  88. - (void)setLocationRadius:(NSString *)str {
  89. [self addCustomParameterWithName:kLocationRadiusParamName
  90. value:str];
  91. }
  92. - (NSString *)locationRadius {
  93. return [self valueForParameterWithName:kLocationRadiusParamName];
  94. }
  95. - (void)setHasCaptions:(BOOL)flag {
  96. [self addCustomParameterWithName:kCaptionParamName
  97. boolValue:flag
  98. defaultValue:NO];
  99. }
  100. - (BOOL)hasCaptions {
  101. return [self boolValueForParameterWithName:kCaptionParamName
  102. defaultValue:NO];
  103. }
  104. - (void)setShouldRequire3D:(BOOL)flag {
  105. [self addCustomParameterWithName:k3DParamName
  106. boolValue:flag
  107. defaultValue:NO];
  108. }
  109. - (BOOL)shouldRequire3D {
  110. return [self boolValueForParameterWithName:k3DParamName
  111. defaultValue:NO];
  112. }
  113. - (void)setShouldInline:(BOOL)flag {
  114. [self addCustomParameterWithName:kInlineParamName
  115. boolValue:flag
  116. defaultValue:NO];
  117. }
  118. - (BOOL)shouldInline {
  119. return [self boolValueForParameterWithName:kInlineParamName
  120. defaultValue:NO];
  121. }
  122. - (void)setUploader:(NSString *)str {
  123. [self addCustomParameterWithName:kUploaderParamName
  124. value:str];
  125. }
  126. - (NSString *)uploader {
  127. return [self valueForParameterWithName:kUploaderParamName];
  128. }
  129. - (void)setSafeSearch:(NSString *)str {
  130. [self addCustomParameterWithName:kSafeSearchParamName
  131. value:str];
  132. }
  133. - (NSString *)safeSearch {
  134. return [self valueForParameterWithName:kSafeSearchParamName];
  135. }
  136. @end
  137. #endif // !GDATA_REQUIRE_SERVICE_INCLUDES || GDATA_INCLUDE_YOUTUBE_SERVICE