You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

7518 lines
235 KiB

  1. // Package blogger provides access to the Blogger API.
  2. //
  3. // See https://developers.google.com/blogger/docs/3.0/getting_started
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/blogger/v3"
  8. // ...
  9. // bloggerService, err := blogger.New(oauthHttpClient)
  10. package blogger // import "google.golang.org/api/blogger/v3"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "blogger:v3"
  41. const apiName = "blogger"
  42. const apiVersion = "v3"
  43. const basePath = "https://www.googleapis.com/blogger/v3/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // Manage your Blogger account
  47. BloggerScope = "https://www.googleapis.com/auth/blogger"
  48. // View your Blogger account
  49. BloggerReadonlyScope = "https://www.googleapis.com/auth/blogger.readonly"
  50. )
  51. func New(client *http.Client) (*Service, error) {
  52. if client == nil {
  53. return nil, errors.New("client is nil")
  54. }
  55. s := &Service{client: client, BasePath: basePath}
  56. s.BlogUserInfos = NewBlogUserInfosService(s)
  57. s.Blogs = NewBlogsService(s)
  58. s.Comments = NewCommentsService(s)
  59. s.PageViews = NewPageViewsService(s)
  60. s.Pages = NewPagesService(s)
  61. s.PostUserInfos = NewPostUserInfosService(s)
  62. s.Posts = NewPostsService(s)
  63. s.Users = NewUsersService(s)
  64. return s, nil
  65. }
  66. type Service struct {
  67. client *http.Client
  68. BasePath string // API endpoint base URL
  69. UserAgent string // optional additional User-Agent fragment
  70. BlogUserInfos *BlogUserInfosService
  71. Blogs *BlogsService
  72. Comments *CommentsService
  73. PageViews *PageViewsService
  74. Pages *PagesService
  75. PostUserInfos *PostUserInfosService
  76. Posts *PostsService
  77. Users *UsersService
  78. }
  79. func (s *Service) userAgent() string {
  80. if s.UserAgent == "" {
  81. return googleapi.UserAgent
  82. }
  83. return googleapi.UserAgent + " " + s.UserAgent
  84. }
  85. func NewBlogUserInfosService(s *Service) *BlogUserInfosService {
  86. rs := &BlogUserInfosService{s: s}
  87. return rs
  88. }
  89. type BlogUserInfosService struct {
  90. s *Service
  91. }
  92. func NewBlogsService(s *Service) *BlogsService {
  93. rs := &BlogsService{s: s}
  94. return rs
  95. }
  96. type BlogsService struct {
  97. s *Service
  98. }
  99. func NewCommentsService(s *Service) *CommentsService {
  100. rs := &CommentsService{s: s}
  101. return rs
  102. }
  103. type CommentsService struct {
  104. s *Service
  105. }
  106. func NewPageViewsService(s *Service) *PageViewsService {
  107. rs := &PageViewsService{s: s}
  108. return rs
  109. }
  110. type PageViewsService struct {
  111. s *Service
  112. }
  113. func NewPagesService(s *Service) *PagesService {
  114. rs := &PagesService{s: s}
  115. return rs
  116. }
  117. type PagesService struct {
  118. s *Service
  119. }
  120. func NewPostUserInfosService(s *Service) *PostUserInfosService {
  121. rs := &PostUserInfosService{s: s}
  122. return rs
  123. }
  124. type PostUserInfosService struct {
  125. s *Service
  126. }
  127. func NewPostsService(s *Service) *PostsService {
  128. rs := &PostsService{s: s}
  129. return rs
  130. }
  131. type PostsService struct {
  132. s *Service
  133. }
  134. func NewUsersService(s *Service) *UsersService {
  135. rs := &UsersService{s: s}
  136. return rs
  137. }
  138. type UsersService struct {
  139. s *Service
  140. }
  141. type Blog struct {
  142. // CustomMetaData: The JSON custom meta-data for the Blog
  143. CustomMetaData string `json:"customMetaData,omitempty"`
  144. // Description: The description of this blog. This is displayed
  145. // underneath the title.
  146. Description string `json:"description,omitempty"`
  147. // Id: The identifier for this resource.
  148. Id string `json:"id,omitempty"`
  149. // Kind: The kind of this entry. Always blogger#blog
  150. Kind string `json:"kind,omitempty"`
  151. // Locale: The locale this Blog is set to.
  152. Locale *BlogLocale `json:"locale,omitempty"`
  153. // Name: The name of this blog. This is displayed as the title.
  154. Name string `json:"name,omitempty"`
  155. // Pages: The container of pages in this blog.
  156. Pages *BlogPages `json:"pages,omitempty"`
  157. // Posts: The container of posts in this blog.
  158. Posts *BlogPosts `json:"posts,omitempty"`
  159. // Published: RFC 3339 date-time when this blog was published.
  160. Published string `json:"published,omitempty"`
  161. // SelfLink: The API REST URL to fetch this resource from.
  162. SelfLink string `json:"selfLink,omitempty"`
  163. // Status: The status of the blog.
  164. Status string `json:"status,omitempty"`
  165. // Updated: RFC 3339 date-time when this blog was last updated.
  166. Updated string `json:"updated,omitempty"`
  167. // Url: The URL where this blog is published.
  168. Url string `json:"url,omitempty"`
  169. // ServerResponse contains the HTTP response code and headers from the
  170. // server.
  171. googleapi.ServerResponse `json:"-"`
  172. // ForceSendFields is a list of field names (e.g. "CustomMetaData") to
  173. // unconditionally include in API requests. By default, fields with
  174. // empty values are omitted from API requests. However, any non-pointer,
  175. // non-interface field appearing in ForceSendFields will be sent to the
  176. // server regardless of whether the field is empty or not. This may be
  177. // used to include empty fields in Patch requests.
  178. ForceSendFields []string `json:"-"`
  179. // NullFields is a list of field names (e.g. "CustomMetaData") to
  180. // include in API requests with the JSON null value. By default, fields
  181. // with empty values are omitted from API requests. However, any field
  182. // with an empty value appearing in NullFields will be sent to the
  183. // server as null. It is an error if a field in this list has a
  184. // non-empty value. This may be used to include null fields in Patch
  185. // requests.
  186. NullFields []string `json:"-"`
  187. }
  188. func (s *Blog) MarshalJSON() ([]byte, error) {
  189. type NoMethod Blog
  190. raw := NoMethod(*s)
  191. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  192. }
  193. // BlogLocale: The locale this Blog is set to.
  194. type BlogLocale struct {
  195. // Country: The country this blog's locale is set to.
  196. Country string `json:"country,omitempty"`
  197. // Language: The language this blog is authored in.
  198. Language string `json:"language,omitempty"`
  199. // Variant: The language variant this blog is authored in.
  200. Variant string `json:"variant,omitempty"`
  201. // ForceSendFields is a list of field names (e.g. "Country") to
  202. // unconditionally include in API requests. By default, fields with
  203. // empty values are omitted from API requests. However, any non-pointer,
  204. // non-interface field appearing in ForceSendFields will be sent to the
  205. // server regardless of whether the field is empty or not. This may be
  206. // used to include empty fields in Patch requests.
  207. ForceSendFields []string `json:"-"`
  208. // NullFields is a list of field names (e.g. "Country") to include in
  209. // API requests with the JSON null value. By default, fields with empty
  210. // values are omitted from API requests. However, any field with an
  211. // empty value appearing in NullFields will be sent to the server as
  212. // null. It is an error if a field in this list has a non-empty value.
  213. // This may be used to include null fields in Patch requests.
  214. NullFields []string `json:"-"`
  215. }
  216. func (s *BlogLocale) MarshalJSON() ([]byte, error) {
  217. type NoMethod BlogLocale
  218. raw := NoMethod(*s)
  219. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  220. }
  221. // BlogPages: The container of pages in this blog.
  222. type BlogPages struct {
  223. // SelfLink: The URL of the container for pages in this blog.
  224. SelfLink string `json:"selfLink,omitempty"`
  225. // TotalItems: The count of pages in this blog.
  226. TotalItems int64 `json:"totalItems,omitempty"`
  227. // ForceSendFields is a list of field names (e.g. "SelfLink") to
  228. // unconditionally include in API requests. By default, fields with
  229. // empty values are omitted from API requests. However, any non-pointer,
  230. // non-interface field appearing in ForceSendFields will be sent to the
  231. // server regardless of whether the field is empty or not. This may be
  232. // used to include empty fields in Patch requests.
  233. ForceSendFields []string `json:"-"`
  234. // NullFields is a list of field names (e.g. "SelfLink") to include in
  235. // API requests with the JSON null value. By default, fields with empty
  236. // values are omitted from API requests. However, any field with an
  237. // empty value appearing in NullFields will be sent to the server as
  238. // null. It is an error if a field in this list has a non-empty value.
  239. // This may be used to include null fields in Patch requests.
  240. NullFields []string `json:"-"`
  241. }
  242. func (s *BlogPages) MarshalJSON() ([]byte, error) {
  243. type NoMethod BlogPages
  244. raw := NoMethod(*s)
  245. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  246. }
  247. // BlogPosts: The container of posts in this blog.
  248. type BlogPosts struct {
  249. // Items: The List of Posts for this Blog.
  250. Items []*Post `json:"items,omitempty"`
  251. // SelfLink: The URL of the container for posts in this blog.
  252. SelfLink string `json:"selfLink,omitempty"`
  253. // TotalItems: The count of posts in this blog.
  254. TotalItems int64 `json:"totalItems,omitempty"`
  255. // ForceSendFields is a list of field names (e.g. "Items") to
  256. // unconditionally include in API requests. By default, fields with
  257. // empty values are omitted from API requests. However, any non-pointer,
  258. // non-interface field appearing in ForceSendFields will be sent to the
  259. // server regardless of whether the field is empty or not. This may be
  260. // used to include empty fields in Patch requests.
  261. ForceSendFields []string `json:"-"`
  262. // NullFields is a list of field names (e.g. "Items") to include in API
  263. // requests with the JSON null value. By default, fields with empty
  264. // values are omitted from API requests. However, any field with an
  265. // empty value appearing in NullFields will be sent to the server as
  266. // null. It is an error if a field in this list has a non-empty value.
  267. // This may be used to include null fields in Patch requests.
  268. NullFields []string `json:"-"`
  269. }
  270. func (s *BlogPosts) MarshalJSON() ([]byte, error) {
  271. type NoMethod BlogPosts
  272. raw := NoMethod(*s)
  273. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  274. }
  275. type BlogList struct {
  276. // BlogUserInfos: Admin level list of blog per-user information
  277. BlogUserInfos []*BlogUserInfo `json:"blogUserInfos,omitempty"`
  278. // Items: The list of Blogs this user has Authorship or Admin rights
  279. // over.
  280. Items []*Blog `json:"items,omitempty"`
  281. // Kind: The kind of this entity. Always blogger#blogList
  282. Kind string `json:"kind,omitempty"`
  283. // ServerResponse contains the HTTP response code and headers from the
  284. // server.
  285. googleapi.ServerResponse `json:"-"`
  286. // ForceSendFields is a list of field names (e.g. "BlogUserInfos") to
  287. // unconditionally include in API requests. By default, fields with
  288. // empty values are omitted from API requests. However, any non-pointer,
  289. // non-interface field appearing in ForceSendFields will be sent to the
  290. // server regardless of whether the field is empty or not. This may be
  291. // used to include empty fields in Patch requests.
  292. ForceSendFields []string `json:"-"`
  293. // NullFields is a list of field names (e.g. "BlogUserInfos") to include
  294. // in API requests with the JSON null value. By default, fields with
  295. // empty values are omitted from API requests. However, any field with
  296. // an empty value appearing in NullFields will be sent to the server as
  297. // null. It is an error if a field in this list has a non-empty value.
  298. // This may be used to include null fields in Patch requests.
  299. NullFields []string `json:"-"`
  300. }
  301. func (s *BlogList) MarshalJSON() ([]byte, error) {
  302. type NoMethod BlogList
  303. raw := NoMethod(*s)
  304. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  305. }
  306. type BlogPerUserInfo struct {
  307. // BlogId: ID of the Blog resource
  308. BlogId string `json:"blogId,omitempty"`
  309. // HasAdminAccess: True if the user has Admin level access to the blog.
  310. HasAdminAccess bool `json:"hasAdminAccess,omitempty"`
  311. // Kind: The kind of this entity. Always blogger#blogPerUserInfo
  312. Kind string `json:"kind,omitempty"`
  313. // PhotosAlbumKey: The Photo Album Key for the user when adding photos
  314. // to the blog
  315. PhotosAlbumKey string `json:"photosAlbumKey,omitempty"`
  316. // Role: Access permissions that the user has for the blog (ADMIN,
  317. // AUTHOR, or READER).
  318. Role string `json:"role,omitempty"`
  319. // UserId: ID of the User
  320. UserId string `json:"userId,omitempty"`
  321. // ForceSendFields is a list of field names (e.g. "BlogId") to
  322. // unconditionally include in API requests. By default, fields with
  323. // empty values are omitted from API requests. However, any non-pointer,
  324. // non-interface field appearing in ForceSendFields will be sent to the
  325. // server regardless of whether the field is empty or not. This may be
  326. // used to include empty fields in Patch requests.
  327. ForceSendFields []string `json:"-"`
  328. // NullFields is a list of field names (e.g. "BlogId") to include in API
  329. // requests with the JSON null value. By default, fields with empty
  330. // values are omitted from API requests. However, any field with an
  331. // empty value appearing in NullFields will be sent to the server as
  332. // null. It is an error if a field in this list has a non-empty value.
  333. // This may be used to include null fields in Patch requests.
  334. NullFields []string `json:"-"`
  335. }
  336. func (s *BlogPerUserInfo) MarshalJSON() ([]byte, error) {
  337. type NoMethod BlogPerUserInfo
  338. raw := NoMethod(*s)
  339. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  340. }
  341. type BlogUserInfo struct {
  342. // Blog: The Blog resource.
  343. Blog *Blog `json:"blog,omitempty"`
  344. // BlogUserInfo: Information about a User for the Blog.
  345. BlogUserInfo *BlogPerUserInfo `json:"blog_user_info,omitempty"`
  346. // Kind: The kind of this entity. Always blogger#blogUserInfo
  347. Kind string `json:"kind,omitempty"`
  348. // ServerResponse contains the HTTP response code and headers from the
  349. // server.
  350. googleapi.ServerResponse `json:"-"`
  351. // ForceSendFields is a list of field names (e.g. "Blog") to
  352. // unconditionally include in API requests. By default, fields with
  353. // empty values are omitted from API requests. However, any non-pointer,
  354. // non-interface field appearing in ForceSendFields will be sent to the
  355. // server regardless of whether the field is empty or not. This may be
  356. // used to include empty fields in Patch requests.
  357. ForceSendFields []string `json:"-"`
  358. // NullFields is a list of field names (e.g. "Blog") to include in API
  359. // requests with the JSON null value. By default, fields with empty
  360. // values are omitted from API requests. However, any field with an
  361. // empty value appearing in NullFields will be sent to the server as
  362. // null. It is an error if a field in this list has a non-empty value.
  363. // This may be used to include null fields in Patch requests.
  364. NullFields []string `json:"-"`
  365. }
  366. func (s *BlogUserInfo) MarshalJSON() ([]byte, error) {
  367. type NoMethod BlogUserInfo
  368. raw := NoMethod(*s)
  369. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  370. }
  371. type Comment struct {
  372. // Author: The author of this Comment.
  373. Author *CommentAuthor `json:"author,omitempty"`
  374. // Blog: Data about the blog containing this comment.
  375. Blog *CommentBlog `json:"blog,omitempty"`
  376. // Content: The actual content of the comment. May include HTML markup.
  377. Content string `json:"content,omitempty"`
  378. // Id: The identifier for this resource.
  379. Id string `json:"id,omitempty"`
  380. // InReplyTo: Data about the comment this is in reply to.
  381. InReplyTo *CommentInReplyTo `json:"inReplyTo,omitempty"`
  382. // Kind: The kind of this entry. Always blogger#comment
  383. Kind string `json:"kind,omitempty"`
  384. // Post: Data about the post containing this comment.
  385. Post *CommentPost `json:"post,omitempty"`
  386. // Published: RFC 3339 date-time when this comment was published.
  387. Published string `json:"published,omitempty"`
  388. // SelfLink: The API REST URL to fetch this resource from.
  389. SelfLink string `json:"selfLink,omitempty"`
  390. // Status: The status of the comment (only populated for admin users)
  391. Status string `json:"status,omitempty"`
  392. // Updated: RFC 3339 date-time when this comment was last updated.
  393. Updated string `json:"updated,omitempty"`
  394. // ServerResponse contains the HTTP response code and headers from the
  395. // server.
  396. googleapi.ServerResponse `json:"-"`
  397. // ForceSendFields is a list of field names (e.g. "Author") to
  398. // unconditionally include in API requests. By default, fields with
  399. // empty values are omitted from API requests. However, any non-pointer,
  400. // non-interface field appearing in ForceSendFields will be sent to the
  401. // server regardless of whether the field is empty or not. This may be
  402. // used to include empty fields in Patch requests.
  403. ForceSendFields []string `json:"-"`
  404. // NullFields is a list of field names (e.g. "Author") to include in API
  405. // requests with the JSON null value. By default, fields with empty
  406. // values are omitted from API requests. However, any field with an
  407. // empty value appearing in NullFields will be sent to the server as
  408. // null. It is an error if a field in this list has a non-empty value.
  409. // This may be used to include null fields in Patch requests.
  410. NullFields []string `json:"-"`
  411. }
  412. func (s *Comment) MarshalJSON() ([]byte, error) {
  413. type NoMethod Comment
  414. raw := NoMethod(*s)
  415. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  416. }
  417. // CommentAuthor: The author of this Comment.
  418. type CommentAuthor struct {
  419. // DisplayName: The display name.
  420. DisplayName string `json:"displayName,omitempty"`
  421. // Id: The identifier of the Comment creator.
  422. Id string `json:"id,omitempty"`
  423. // Image: The comment creator's avatar.
  424. Image *CommentAuthorImage `json:"image,omitempty"`
  425. // Url: The URL of the Comment creator's Profile page.
  426. Url string `json:"url,omitempty"`
  427. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  428. // unconditionally include in API requests. By default, fields with
  429. // empty values are omitted from API requests. However, any non-pointer,
  430. // non-interface field appearing in ForceSendFields will be sent to the
  431. // server regardless of whether the field is empty or not. This may be
  432. // used to include empty fields in Patch requests.
  433. ForceSendFields []string `json:"-"`
  434. // NullFields is a list of field names (e.g. "DisplayName") to include
  435. // in API requests with the JSON null value. By default, fields with
  436. // empty values are omitted from API requests. However, any field with
  437. // an empty value appearing in NullFields will be sent to the server as
  438. // null. It is an error if a field in this list has a non-empty value.
  439. // This may be used to include null fields in Patch requests.
  440. NullFields []string `json:"-"`
  441. }
  442. func (s *CommentAuthor) MarshalJSON() ([]byte, error) {
  443. type NoMethod CommentAuthor
  444. raw := NoMethod(*s)
  445. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  446. }
  447. // CommentAuthorImage: The comment creator's avatar.
  448. type CommentAuthorImage struct {
  449. // Url: The comment creator's avatar URL.
  450. Url string `json:"url,omitempty"`
  451. // ForceSendFields is a list of field names (e.g. "Url") to
  452. // unconditionally include in API requests. By default, fields with
  453. // empty values are omitted from API requests. However, any non-pointer,
  454. // non-interface field appearing in ForceSendFields will be sent to the
  455. // server regardless of whether the field is empty or not. This may be
  456. // used to include empty fields in Patch requests.
  457. ForceSendFields []string `json:"-"`
  458. // NullFields is a list of field names (e.g. "Url") to include in API
  459. // requests with the JSON null value. By default, fields with empty
  460. // values are omitted from API requests. However, any field with an
  461. // empty value appearing in NullFields will be sent to the server as
  462. // null. It is an error if a field in this list has a non-empty value.
  463. // This may be used to include null fields in Patch requests.
  464. NullFields []string `json:"-"`
  465. }
  466. func (s *CommentAuthorImage) MarshalJSON() ([]byte, error) {
  467. type NoMethod CommentAuthorImage
  468. raw := NoMethod(*s)
  469. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  470. }
  471. // CommentBlog: Data about the blog containing this comment.
  472. type CommentBlog struct {
  473. // Id: The identifier of the blog containing this comment.
  474. Id string `json:"id,omitempty"`
  475. // ForceSendFields is a list of field names (e.g. "Id") to
  476. // unconditionally include in API requests. By default, fields with
  477. // empty values are omitted from API requests. However, any non-pointer,
  478. // non-interface field appearing in ForceSendFields will be sent to the
  479. // server regardless of whether the field is empty or not. This may be
  480. // used to include empty fields in Patch requests.
  481. ForceSendFields []string `json:"-"`
  482. // NullFields is a list of field names (e.g. "Id") to include in API
  483. // requests with the JSON null value. By default, fields with empty
  484. // values are omitted from API requests. However, any field with an
  485. // empty value appearing in NullFields will be sent to the server as
  486. // null. It is an error if a field in this list has a non-empty value.
  487. // This may be used to include null fields in Patch requests.
  488. NullFields []string `json:"-"`
  489. }
  490. func (s *CommentBlog) MarshalJSON() ([]byte, error) {
  491. type NoMethod CommentBlog
  492. raw := NoMethod(*s)
  493. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  494. }
  495. // CommentInReplyTo: Data about the comment this is in reply to.
  496. type CommentInReplyTo struct {
  497. // Id: The identified of the parent of this comment.
  498. Id string `json:"id,omitempty"`
  499. // ForceSendFields is a list of field names (e.g. "Id") to
  500. // unconditionally include in API requests. By default, fields with
  501. // empty values are omitted from API requests. However, any non-pointer,
  502. // non-interface field appearing in ForceSendFields will be sent to the
  503. // server regardless of whether the field is empty or not. This may be
  504. // used to include empty fields in Patch requests.
  505. ForceSendFields []string `json:"-"`
  506. // NullFields is a list of field names (e.g. "Id") to include in API
  507. // requests with the JSON null value. By default, fields with empty
  508. // values are omitted from API requests. However, any field with an
  509. // empty value appearing in NullFields will be sent to the server as
  510. // null. It is an error if a field in this list has a non-empty value.
  511. // This may be used to include null fields in Patch requests.
  512. NullFields []string `json:"-"`
  513. }
  514. func (s *CommentInReplyTo) MarshalJSON() ([]byte, error) {
  515. type NoMethod CommentInReplyTo
  516. raw := NoMethod(*s)
  517. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  518. }
  519. // CommentPost: Data about the post containing this comment.
  520. type CommentPost struct {
  521. // Id: The identifier of the post containing this comment.
  522. Id string `json:"id,omitempty"`
  523. // ForceSendFields is a list of field names (e.g. "Id") to
  524. // unconditionally include in API requests. By default, fields with
  525. // empty values are omitted from API requests. However, any non-pointer,
  526. // non-interface field appearing in ForceSendFields will be sent to the
  527. // server regardless of whether the field is empty or not. This may be
  528. // used to include empty fields in Patch requests.
  529. ForceSendFields []string `json:"-"`
  530. // NullFields is a list of field names (e.g. "Id") to include in API
  531. // requests with the JSON null value. By default, fields with empty
  532. // values are omitted from API requests. However, any field with an
  533. // empty value appearing in NullFields will be sent to the server as
  534. // null. It is an error if a field in this list has a non-empty value.
  535. // This may be used to include null fields in Patch requests.
  536. NullFields []string `json:"-"`
  537. }
  538. func (s *CommentPost) MarshalJSON() ([]byte, error) {
  539. type NoMethod CommentPost
  540. raw := NoMethod(*s)
  541. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  542. }
  543. type CommentList struct {
  544. // Etag: Etag of the response.
  545. Etag string `json:"etag,omitempty"`
  546. // Items: The List of Comments for a Post.
  547. Items []*Comment `json:"items,omitempty"`
  548. // Kind: The kind of this entry. Always blogger#commentList
  549. Kind string `json:"kind,omitempty"`
  550. // NextPageToken: Pagination token to fetch the next page, if one
  551. // exists.
  552. NextPageToken string `json:"nextPageToken,omitempty"`
  553. // PrevPageToken: Pagination token to fetch the previous page, if one
  554. // exists.
  555. PrevPageToken string `json:"prevPageToken,omitempty"`
  556. // ServerResponse contains the HTTP response code and headers from the
  557. // server.
  558. googleapi.ServerResponse `json:"-"`
  559. // ForceSendFields is a list of field names (e.g. "Etag") to
  560. // unconditionally include in API requests. By default, fields with
  561. // empty values are omitted from API requests. However, any non-pointer,
  562. // non-interface field appearing in ForceSendFields will be sent to the
  563. // server regardless of whether the field is empty or not. This may be
  564. // used to include empty fields in Patch requests.
  565. ForceSendFields []string `json:"-"`
  566. // NullFields is a list of field names (e.g. "Etag") to include in API
  567. // requests with the JSON null value. By default, fields with empty
  568. // values are omitted from API requests. However, any field with an
  569. // empty value appearing in NullFields will be sent to the server as
  570. // null. It is an error if a field in this list has a non-empty value.
  571. // This may be used to include null fields in Patch requests.
  572. NullFields []string `json:"-"`
  573. }
  574. func (s *CommentList) MarshalJSON() ([]byte, error) {
  575. type NoMethod CommentList
  576. raw := NoMethod(*s)
  577. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  578. }
  579. type Page struct {
  580. // Author: The author of this Page.
  581. Author *PageAuthor `json:"author,omitempty"`
  582. // Blog: Data about the blog containing this Page.
  583. Blog *PageBlog `json:"blog,omitempty"`
  584. // Content: The body content of this Page, in HTML.
  585. Content string `json:"content,omitempty"`
  586. // Etag: Etag of the resource.
  587. Etag string `json:"etag,omitempty"`
  588. // Id: The identifier for this resource.
  589. Id string `json:"id,omitempty"`
  590. // Kind: The kind of this entity. Always blogger#page
  591. Kind string `json:"kind,omitempty"`
  592. // Published: RFC 3339 date-time when this Page was published.
  593. Published string `json:"published,omitempty"`
  594. // SelfLink: The API REST URL to fetch this resource from.
  595. SelfLink string `json:"selfLink,omitempty"`
  596. // Status: The status of the page for admin resources (either LIVE or
  597. // DRAFT).
  598. Status string `json:"status,omitempty"`
  599. // Title: The title of this entity. This is the name displayed in the
  600. // Admin user interface.
  601. Title string `json:"title,omitempty"`
  602. // Updated: RFC 3339 date-time when this Page was last updated.
  603. Updated string `json:"updated,omitempty"`
  604. // Url: The URL that this Page is displayed at.
  605. Url string `json:"url,omitempty"`
  606. // ServerResponse contains the HTTP response code and headers from the
  607. // server.
  608. googleapi.ServerResponse `json:"-"`
  609. // ForceSendFields is a list of field names (e.g. "Author") to
  610. // unconditionally include in API requests. By default, fields with
  611. // empty values are omitted from API requests. However, any non-pointer,
  612. // non-interface field appearing in ForceSendFields will be sent to the
  613. // server regardless of whether the field is empty or not. This may be
  614. // used to include empty fields in Patch requests.
  615. ForceSendFields []string `json:"-"`
  616. // NullFields is a list of field names (e.g. "Author") to include in API
  617. // requests with the JSON null value. By default, fields with empty
  618. // values are omitted from API requests. However, any field with an
  619. // empty value appearing in NullFields will be sent to the server as
  620. // null. It is an error if a field in this list has a non-empty value.
  621. // This may be used to include null fields in Patch requests.
  622. NullFields []string `json:"-"`
  623. }
  624. func (s *Page) MarshalJSON() ([]byte, error) {
  625. type NoMethod Page
  626. raw := NoMethod(*s)
  627. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  628. }
  629. // PageAuthor: The author of this Page.
  630. type PageAuthor struct {
  631. // DisplayName: The display name.
  632. DisplayName string `json:"displayName,omitempty"`
  633. // Id: The identifier of the Page creator.
  634. Id string `json:"id,omitempty"`
  635. // Image: The page author's avatar.
  636. Image *PageAuthorImage `json:"image,omitempty"`
  637. // Url: The URL of the Page creator's Profile page.
  638. Url string `json:"url,omitempty"`
  639. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  640. // unconditionally include in API requests. By default, fields with
  641. // empty values are omitted from API requests. However, any non-pointer,
  642. // non-interface field appearing in ForceSendFields will be sent to the
  643. // server regardless of whether the field is empty or not. This may be
  644. // used to include empty fields in Patch requests.
  645. ForceSendFields []string `json:"-"`
  646. // NullFields is a list of field names (e.g. "DisplayName") to include
  647. // in API requests with the JSON null value. By default, fields with
  648. // empty values are omitted from API requests. However, any field with
  649. // an empty value appearing in NullFields will be sent to the server as
  650. // null. It is an error if a field in this list has a non-empty value.
  651. // This may be used to include null fields in Patch requests.
  652. NullFields []string `json:"-"`
  653. }
  654. func (s *PageAuthor) MarshalJSON() ([]byte, error) {
  655. type NoMethod PageAuthor
  656. raw := NoMethod(*s)
  657. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  658. }
  659. // PageAuthorImage: The page author's avatar.
  660. type PageAuthorImage struct {
  661. // Url: The page author's avatar URL.
  662. Url string `json:"url,omitempty"`
  663. // ForceSendFields is a list of field names (e.g. "Url") to
  664. // unconditionally include in API requests. By default, fields with
  665. // empty values are omitted from API requests. However, any non-pointer,
  666. // non-interface field appearing in ForceSendFields will be sent to the
  667. // server regardless of whether the field is empty or not. This may be
  668. // used to include empty fields in Patch requests.
  669. ForceSendFields []string `json:"-"`
  670. // NullFields is a list of field names (e.g. "Url") to include in API
  671. // requests with the JSON null value. By default, fields with empty
  672. // values are omitted from API requests. However, any field with an
  673. // empty value appearing in NullFields will be sent to the server as
  674. // null. It is an error if a field in this list has a non-empty value.
  675. // This may be used to include null fields in Patch requests.
  676. NullFields []string `json:"-"`
  677. }
  678. func (s *PageAuthorImage) MarshalJSON() ([]byte, error) {
  679. type NoMethod PageAuthorImage
  680. raw := NoMethod(*s)
  681. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  682. }
  683. // PageBlog: Data about the blog containing this Page.
  684. type PageBlog struct {
  685. // Id: The identifier of the blog containing this page.
  686. Id string `json:"id,omitempty"`
  687. // ForceSendFields is a list of field names (e.g. "Id") to
  688. // unconditionally include in API requests. By default, fields with
  689. // empty values are omitted from API requests. However, any non-pointer,
  690. // non-interface field appearing in ForceSendFields will be sent to the
  691. // server regardless of whether the field is empty or not. This may be
  692. // used to include empty fields in Patch requests.
  693. ForceSendFields []string `json:"-"`
  694. // NullFields is a list of field names (e.g. "Id") to include in API
  695. // requests with the JSON null value. By default, fields with empty
  696. // values are omitted from API requests. However, any field with an
  697. // empty value appearing in NullFields will be sent to the server as
  698. // null. It is an error if a field in this list has a non-empty value.
  699. // This may be used to include null fields in Patch requests.
  700. NullFields []string `json:"-"`
  701. }
  702. func (s *PageBlog) MarshalJSON() ([]byte, error) {
  703. type NoMethod PageBlog
  704. raw := NoMethod(*s)
  705. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  706. }
  707. type PageList struct {
  708. // Etag: Etag of the response.
  709. Etag string `json:"etag,omitempty"`
  710. // Items: The list of Pages for a Blog.
  711. Items []*Page `json:"items,omitempty"`
  712. // Kind: The kind of this entity. Always blogger#pageList
  713. Kind string `json:"kind,omitempty"`
  714. // NextPageToken: Pagination token to fetch the next page, if one
  715. // exists.
  716. NextPageToken string `json:"nextPageToken,omitempty"`
  717. // ServerResponse contains the HTTP response code and headers from the
  718. // server.
  719. googleapi.ServerResponse `json:"-"`
  720. // ForceSendFields is a list of field names (e.g. "Etag") to
  721. // unconditionally include in API requests. By default, fields with
  722. // empty values are omitted from API requests. However, any non-pointer,
  723. // non-interface field appearing in ForceSendFields will be sent to the
  724. // server regardless of whether the field is empty or not. This may be
  725. // used to include empty fields in Patch requests.
  726. ForceSendFields []string `json:"-"`
  727. // NullFields is a list of field names (e.g. "Etag") to include in API
  728. // requests with the JSON null value. By default, fields with empty
  729. // values are omitted from API requests. However, any field with an
  730. // empty value appearing in NullFields will be sent to the server as
  731. // null. It is an error if a field in this list has a non-empty value.
  732. // This may be used to include null fields in Patch requests.
  733. NullFields []string `json:"-"`
  734. }
  735. func (s *PageList) MarshalJSON() ([]byte, error) {
  736. type NoMethod PageList
  737. raw := NoMethod(*s)
  738. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  739. }
  740. type Pageviews struct {
  741. // BlogId: Blog Id
  742. BlogId string `json:"blogId,omitempty"`
  743. // Counts: The container of posts in this blog.
  744. Counts []*PageviewsCounts `json:"counts,omitempty"`
  745. // Kind: The kind of this entry. Always blogger#page_views
  746. Kind string `json:"kind,omitempty"`
  747. // ServerResponse contains the HTTP response code and headers from the
  748. // server.
  749. googleapi.ServerResponse `json:"-"`
  750. // ForceSendFields is a list of field names (e.g. "BlogId") to
  751. // unconditionally include in API requests. By default, fields with
  752. // empty values are omitted from API requests. However, any non-pointer,
  753. // non-interface field appearing in ForceSendFields will be sent to the
  754. // server regardless of whether the field is empty or not. This may be
  755. // used to include empty fields in Patch requests.
  756. ForceSendFields []string `json:"-"`
  757. // NullFields is a list of field names (e.g. "BlogId") to include in API
  758. // requests with the JSON null value. By default, fields with empty
  759. // values are omitted from API requests. However, any field with an
  760. // empty value appearing in NullFields will be sent to the server as
  761. // null. It is an error if a field in this list has a non-empty value.
  762. // This may be used to include null fields in Patch requests.
  763. NullFields []string `json:"-"`
  764. }
  765. func (s *Pageviews) MarshalJSON() ([]byte, error) {
  766. type NoMethod Pageviews
  767. raw := NoMethod(*s)
  768. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  769. }
  770. type PageviewsCounts struct {
  771. // Count: Count of page views for the given time range
  772. Count int64 `json:"count,omitempty,string"`
  773. // TimeRange: Time range the given count applies to
  774. TimeRange string `json:"timeRange,omitempty"`
  775. // ForceSendFields is a list of field names (e.g. "Count") to
  776. // unconditionally include in API requests. By default, fields with
  777. // empty values are omitted from API requests. However, any non-pointer,
  778. // non-interface field appearing in ForceSendFields will be sent to the
  779. // server regardless of whether the field is empty or not. This may be
  780. // used to include empty fields in Patch requests.
  781. ForceSendFields []string `json:"-"`
  782. // NullFields is a list of field names (e.g. "Count") to include in API
  783. // requests with the JSON null value. By default, fields with empty
  784. // values are omitted from API requests. However, any field with an
  785. // empty value appearing in NullFields will be sent to the server as
  786. // null. It is an error if a field in this list has a non-empty value.
  787. // This may be used to include null fields in Patch requests.
  788. NullFields []string `json:"-"`
  789. }
  790. func (s *PageviewsCounts) MarshalJSON() ([]byte, error) {
  791. type NoMethod PageviewsCounts
  792. raw := NoMethod(*s)
  793. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  794. }
  795. type Post struct {
  796. // Author: The author of this Post.
  797. Author *PostAuthor `json:"author,omitempty"`
  798. // Blog: Data about the blog containing this Post.
  799. Blog *PostBlog `json:"blog,omitempty"`
  800. // Content: The content of the Post. May contain HTML markup.
  801. Content string `json:"content,omitempty"`
  802. // CustomMetaData: The JSON meta-data for the Post.
  803. CustomMetaData string `json:"customMetaData,omitempty"`
  804. // Etag: Etag of the resource.
  805. Etag string `json:"etag,omitempty"`
  806. // Id: The identifier of this Post.
  807. Id string `json:"id,omitempty"`
  808. // Images: Display image for the Post.
  809. Images []*PostImages `json:"images,omitempty"`
  810. // Kind: The kind of this entity. Always blogger#post
  811. Kind string `json:"kind,omitempty"`
  812. // Labels: The list of labels this Post was tagged with.
  813. Labels []string `json:"labels,omitempty"`
  814. // Location: The location for geotagged posts.
  815. Location *PostLocation `json:"location,omitempty"`
  816. // Published: RFC 3339 date-time when this Post was published.
  817. Published string `json:"published,omitempty"`
  818. // ReaderComments: Comment control and display setting for readers of
  819. // this post.
  820. ReaderComments string `json:"readerComments,omitempty"`
  821. // Replies: The container of comments on this Post.
  822. Replies *PostReplies `json:"replies,omitempty"`
  823. // SelfLink: The API REST URL to fetch this resource from.
  824. SelfLink string `json:"selfLink,omitempty"`
  825. // Status: Status of the post. Only set for admin-level requests
  826. Status string `json:"status,omitempty"`
  827. // Title: The title of the Post.
  828. Title string `json:"title,omitempty"`
  829. // TitleLink: The title link URL, similar to atom's related link.
  830. TitleLink string `json:"titleLink,omitempty"`
  831. // Updated: RFC 3339 date-time when this Post was last updated.
  832. Updated string `json:"updated,omitempty"`
  833. // Url: The URL where this Post is displayed.
  834. Url string `json:"url,omitempty"`
  835. // ServerResponse contains the HTTP response code and headers from the
  836. // server.
  837. googleapi.ServerResponse `json:"-"`
  838. // ForceSendFields is a list of field names (e.g. "Author") to
  839. // unconditionally include in API requests. By default, fields with
  840. // empty values are omitted from API requests. However, any non-pointer,
  841. // non-interface field appearing in ForceSendFields will be sent to the
  842. // server regardless of whether the field is empty or not. This may be
  843. // used to include empty fields in Patch requests.
  844. ForceSendFields []string `json:"-"`
  845. // NullFields is a list of field names (e.g. "Author") to include in API
  846. // requests with the JSON null value. By default, fields with empty
  847. // values are omitted from API requests. However, any field with an
  848. // empty value appearing in NullFields will be sent to the server as
  849. // null. It is an error if a field in this list has a non-empty value.
  850. // This may be used to include null fields in Patch requests.
  851. NullFields []string `json:"-"`
  852. }
  853. func (s *Post) MarshalJSON() ([]byte, error) {
  854. type NoMethod Post
  855. raw := NoMethod(*s)
  856. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  857. }
  858. // PostAuthor: The author of this Post.
  859. type PostAuthor struct {
  860. // DisplayName: The display name.
  861. DisplayName string `json:"displayName,omitempty"`
  862. // Id: The identifier of the Post creator.
  863. Id string `json:"id,omitempty"`
  864. // Image: The Post author's avatar.
  865. Image *PostAuthorImage `json:"image,omitempty"`
  866. // Url: The URL of the Post creator's Profile page.
  867. Url string `json:"url,omitempty"`
  868. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  869. // unconditionally include in API requests. By default, fields with
  870. // empty values are omitted from API requests. However, any non-pointer,
  871. // non-interface field appearing in ForceSendFields will be sent to the
  872. // server regardless of whether the field is empty or not. This may be
  873. // used to include empty fields in Patch requests.
  874. ForceSendFields []string `json:"-"`
  875. // NullFields is a list of field names (e.g. "DisplayName") to include
  876. // in API requests with the JSON null value. By default, fields with
  877. // empty values are omitted from API requests. However, any field with
  878. // an empty value appearing in NullFields will be sent to the server as
  879. // null. It is an error if a field in this list has a non-empty value.
  880. // This may be used to include null fields in Patch requests.
  881. NullFields []string `json:"-"`
  882. }
  883. func (s *PostAuthor) MarshalJSON() ([]byte, error) {
  884. type NoMethod PostAuthor
  885. raw := NoMethod(*s)
  886. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  887. }
  888. // PostAuthorImage: The Post author's avatar.
  889. type PostAuthorImage struct {
  890. // Url: The Post author's avatar URL.
  891. Url string `json:"url,omitempty"`
  892. // ForceSendFields is a list of field names (e.g. "Url") to
  893. // unconditionally include in API requests. By default, fields with
  894. // empty values are omitted from API requests. However, any non-pointer,
  895. // non-interface field appearing in ForceSendFields will be sent to the
  896. // server regardless of whether the field is empty or not. This may be
  897. // used to include empty fields in Patch requests.
  898. ForceSendFields []string `json:"-"`
  899. // NullFields is a list of field names (e.g. "Url") to include in API
  900. // requests with the JSON null value. By default, fields with empty
  901. // values are omitted from API requests. However, any field with an
  902. // empty value appearing in NullFields will be sent to the server as
  903. // null. It is an error if a field in this list has a non-empty value.
  904. // This may be used to include null fields in Patch requests.
  905. NullFields []string `json:"-"`
  906. }
  907. func (s *PostAuthorImage) MarshalJSON() ([]byte, error) {
  908. type NoMethod PostAuthorImage
  909. raw := NoMethod(*s)
  910. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  911. }
  912. // PostBlog: Data about the blog containing this Post.
  913. type PostBlog struct {
  914. // Id: The identifier of the Blog that contains this Post.
  915. Id string `json:"id,omitempty"`
  916. // ForceSendFields is a list of field names (e.g. "Id") to
  917. // unconditionally include in API requests. By default, fields with
  918. // empty values are omitted from API requests. However, any non-pointer,
  919. // non-interface field appearing in ForceSendFields will be sent to the
  920. // server regardless of whether the field is empty or not. This may be
  921. // used to include empty fields in Patch requests.
  922. ForceSendFields []string `json:"-"`
  923. // NullFields is a list of field names (e.g. "Id") to include in API
  924. // requests with the JSON null value. By default, fields with empty
  925. // values are omitted from API requests. However, any field with an
  926. // empty value appearing in NullFields will be sent to the server as
  927. // null. It is an error if a field in this list has a non-empty value.
  928. // This may be used to include null fields in Patch requests.
  929. NullFields []string `json:"-"`
  930. }
  931. func (s *PostBlog) MarshalJSON() ([]byte, error) {
  932. type NoMethod PostBlog
  933. raw := NoMethod(*s)
  934. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  935. }
  936. type PostImages struct {
  937. Url string `json:"url,omitempty"`
  938. // ForceSendFields is a list of field names (e.g. "Url") to
  939. // unconditionally include in API requests. By default, fields with
  940. // empty values are omitted from API requests. However, any non-pointer,
  941. // non-interface field appearing in ForceSendFields will be sent to the
  942. // server regardless of whether the field is empty or not. This may be
  943. // used to include empty fields in Patch requests.
  944. ForceSendFields []string `json:"-"`
  945. // NullFields is a list of field names (e.g. "Url") to include in API
  946. // requests with the JSON null value. By default, fields with empty
  947. // values are omitted from API requests. However, any field with an
  948. // empty value appearing in NullFields will be sent to the server as
  949. // null. It is an error if a field in this list has a non-empty value.
  950. // This may be used to include null fields in Patch requests.
  951. NullFields []string `json:"-"`
  952. }
  953. func (s *PostImages) MarshalJSON() ([]byte, error) {
  954. type NoMethod PostImages
  955. raw := NoMethod(*s)
  956. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  957. }
  958. // PostLocation: The location for geotagged posts.
  959. type PostLocation struct {
  960. // Lat: Location's latitude.
  961. Lat float64 `json:"lat,omitempty"`
  962. // Lng: Location's longitude.
  963. Lng float64 `json:"lng,omitempty"`
  964. // Name: Location name.
  965. Name string `json:"name,omitempty"`
  966. // Span: Location's viewport span. Can be used when rendering a map
  967. // preview.
  968. Span string `json:"span,omitempty"`
  969. // ForceSendFields is a list of field names (e.g. "Lat") to
  970. // unconditionally include in API requests. By default, fields with
  971. // empty values are omitted from API requests. However, any non-pointer,
  972. // non-interface field appearing in ForceSendFields will be sent to the
  973. // server regardless of whether the field is empty or not. This may be
  974. // used to include empty fields in Patch requests.
  975. ForceSendFields []string `json:"-"`
  976. // NullFields is a list of field names (e.g. "Lat") to include in API
  977. // requests with the JSON null value. By default, fields with empty
  978. // values are omitted from API requests. However, any field with an
  979. // empty value appearing in NullFields will be sent to the server as
  980. // null. It is an error if a field in this list has a non-empty value.
  981. // This may be used to include null fields in Patch requests.
  982. NullFields []string `json:"-"`
  983. }
  984. func (s *PostLocation) MarshalJSON() ([]byte, error) {
  985. type NoMethod PostLocation
  986. raw := NoMethod(*s)
  987. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  988. }
  989. func (s *PostLocation) UnmarshalJSON(data []byte) error {
  990. type NoMethod PostLocation
  991. var s1 struct {
  992. Lat gensupport.JSONFloat64 `json:"lat"`
  993. Lng gensupport.JSONFloat64 `json:"lng"`
  994. *NoMethod
  995. }
  996. s1.NoMethod = (*NoMethod)(s)
  997. if err := json.Unmarshal(data, &s1); err != nil {
  998. return err
  999. }
  1000. s.Lat = float64(s1.Lat)
  1001. s.Lng = float64(s1.Lng)
  1002. return nil
  1003. }
  1004. // PostReplies: The container of comments on this Post.
  1005. type PostReplies struct {
  1006. // Items: The List of Comments for this Post.
  1007. Items []*Comment `json:"items,omitempty"`
  1008. // SelfLink: The URL of the comments on this post.
  1009. SelfLink string `json:"selfLink,omitempty"`
  1010. // TotalItems: The count of comments on this post.
  1011. TotalItems int64 `json:"totalItems,omitempty,string"`
  1012. // ForceSendFields is a list of field names (e.g. "Items") to
  1013. // unconditionally include in API requests. By default, fields with
  1014. // empty values are omitted from API requests. However, any non-pointer,
  1015. // non-interface field appearing in ForceSendFields will be sent to the
  1016. // server regardless of whether the field is empty or not. This may be
  1017. // used to include empty fields in Patch requests.
  1018. ForceSendFields []string `json:"-"`
  1019. // NullFields is a list of field names (e.g. "Items") to include in API
  1020. // requests with the JSON null value. By default, fields with empty
  1021. // values are omitted from API requests. However, any field with an
  1022. // empty value appearing in NullFields will be sent to the server as
  1023. // null. It is an error if a field in this list has a non-empty value.
  1024. // This may be used to include null fields in Patch requests.
  1025. NullFields []string `json:"-"`
  1026. }
  1027. func (s *PostReplies) MarshalJSON() ([]byte, error) {
  1028. type NoMethod PostReplies
  1029. raw := NoMethod(*s)
  1030. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1031. }
  1032. type PostList struct {
  1033. // Etag: Etag of the response.
  1034. Etag string `json:"etag,omitempty"`
  1035. // Items: The list of Posts for this Blog.
  1036. Items []*Post `json:"items,omitempty"`
  1037. // Kind: The kind of this entity. Always blogger#postList
  1038. Kind string `json:"kind,omitempty"`
  1039. // NextPageToken: Pagination token to fetch the next page, if one
  1040. // exists.
  1041. NextPageToken string `json:"nextPageToken,omitempty"`
  1042. // ServerResponse contains the HTTP response code and headers from the
  1043. // server.
  1044. googleapi.ServerResponse `json:"-"`
  1045. // ForceSendFields is a list of field names (e.g. "Etag") to
  1046. // unconditionally include in API requests. By default, fields with
  1047. // empty values are omitted from API requests. However, any non-pointer,
  1048. // non-interface field appearing in ForceSendFields will be sent to the
  1049. // server regardless of whether the field is empty or not. This may be
  1050. // used to include empty fields in Patch requests.
  1051. ForceSendFields []string `json:"-"`
  1052. // NullFields is a list of field names (e.g. "Etag") to include in API
  1053. // requests with the JSON null value. By default, fields with empty
  1054. // values are omitted from API requests. However, any field with an
  1055. // empty value appearing in NullFields will be sent to the server as
  1056. // null. It is an error if a field in this list has a non-empty value.
  1057. // This may be used to include null fields in Patch requests.
  1058. NullFields []string `json:"-"`
  1059. }
  1060. func (s *PostList) MarshalJSON() ([]byte, error) {
  1061. type NoMethod PostList
  1062. raw := NoMethod(*s)
  1063. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1064. }
  1065. type PostPerUserInfo struct {
  1066. // BlogId: ID of the Blog that the post resource belongs to.
  1067. BlogId string `json:"blogId,omitempty"`
  1068. // HasEditAccess: True if the user has Author level access to the post.
  1069. HasEditAccess bool `json:"hasEditAccess,omitempty"`
  1070. // Kind: The kind of this entity. Always blogger#postPerUserInfo
  1071. Kind string `json:"kind,omitempty"`
  1072. // PostId: ID of the Post resource.
  1073. PostId string `json:"postId,omitempty"`
  1074. // UserId: ID of the User.
  1075. UserId string `json:"userId,omitempty"`
  1076. // ForceSendFields is a list of field names (e.g. "BlogId") to
  1077. // unconditionally include in API requests. By default, fields with
  1078. // empty values are omitted from API requests. However, any non-pointer,
  1079. // non-interface field appearing in ForceSendFields will be sent to the
  1080. // server regardless of whether the field is empty or not. This may be
  1081. // used to include empty fields in Patch requests.
  1082. ForceSendFields []string `json:"-"`
  1083. // NullFields is a list of field names (e.g. "BlogId") to include in API
  1084. // requests with the JSON null value. By default, fields with empty
  1085. // values are omitted from API requests. However, any field with an
  1086. // empty value appearing in NullFields will be sent to the server as
  1087. // null. It is an error if a field in this list has a non-empty value.
  1088. // This may be used to include null fields in Patch requests.
  1089. NullFields []string `json:"-"`
  1090. }
  1091. func (s *PostPerUserInfo) MarshalJSON() ([]byte, error) {
  1092. type NoMethod PostPerUserInfo
  1093. raw := NoMethod(*s)
  1094. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1095. }
  1096. type PostUserInfo struct {
  1097. // Kind: The kind of this entity. Always blogger#postUserInfo
  1098. Kind string `json:"kind,omitempty"`
  1099. // Post: The Post resource.
  1100. Post *Post `json:"post,omitempty"`
  1101. // PostUserInfo: Information about a User for the Post.
  1102. PostUserInfo *PostPerUserInfo `json:"post_user_info,omitempty"`
  1103. // ServerResponse contains the HTTP response code and headers from the
  1104. // server.
  1105. googleapi.ServerResponse `json:"-"`
  1106. // ForceSendFields is a list of field names (e.g. "Kind") to
  1107. // unconditionally include in API requests. By default, fields with
  1108. // empty values are omitted from API requests. However, any non-pointer,
  1109. // non-interface field appearing in ForceSendFields will be sent to the
  1110. // server regardless of whether the field is empty or not. This may be
  1111. // used to include empty fields in Patch requests.
  1112. ForceSendFields []string `json:"-"`
  1113. // NullFields is a list of field names (e.g. "Kind") to include in API
  1114. // requests with the JSON null value. By default, fields with empty
  1115. // values are omitted from API requests. However, any field with an
  1116. // empty value appearing in NullFields will be sent to the server as
  1117. // null. It is an error if a field in this list has a non-empty value.
  1118. // This may be used to include null fields in Patch requests.
  1119. NullFields []string `json:"-"`
  1120. }
  1121. func (s *PostUserInfo) MarshalJSON() ([]byte, error) {
  1122. type NoMethod PostUserInfo
  1123. raw := NoMethod(*s)
  1124. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1125. }
  1126. type PostUserInfosList struct {
  1127. // Items: The list of Posts with User information for the post, for this
  1128. // Blog.
  1129. Items []*PostUserInfo `json:"items,omitempty"`
  1130. // Kind: The kind of this entity. Always blogger#postList
  1131. Kind string `json:"kind,omitempty"`
  1132. // NextPageToken: Pagination token to fetch the next page, if one
  1133. // exists.
  1134. NextPageToken string `json:"nextPageToken,omitempty"`
  1135. // ServerResponse contains the HTTP response code and headers from the
  1136. // server.
  1137. googleapi.ServerResponse `json:"-"`
  1138. // ForceSendFields is a list of field names (e.g. "Items") to
  1139. // unconditionally include in API requests. By default, fields with
  1140. // empty values are omitted from API requests. However, any non-pointer,
  1141. // non-interface field appearing in ForceSendFields will be sent to the
  1142. // server regardless of whether the field is empty or not. This may be
  1143. // used to include empty fields in Patch requests.
  1144. ForceSendFields []string `json:"-"`
  1145. // NullFields is a list of field names (e.g. "Items") to include in API
  1146. // requests with the JSON null value. By default, fields with empty
  1147. // values are omitted from API requests. However, any field with an
  1148. // empty value appearing in NullFields will be sent to the server as
  1149. // null. It is an error if a field in this list has a non-empty value.
  1150. // This may be used to include null fields in Patch requests.
  1151. NullFields []string `json:"-"`
  1152. }
  1153. func (s *PostUserInfosList) MarshalJSON() ([]byte, error) {
  1154. type NoMethod PostUserInfosList
  1155. raw := NoMethod(*s)
  1156. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1157. }
  1158. type User struct {
  1159. // About: Profile summary information.
  1160. About string `json:"about,omitempty"`
  1161. // Blogs: The container of blogs for this user.
  1162. Blogs *UserBlogs `json:"blogs,omitempty"`
  1163. // Created: The timestamp of when this profile was created, in seconds
  1164. // since epoch.
  1165. Created string `json:"created,omitempty"`
  1166. // DisplayName: The display name.
  1167. DisplayName string `json:"displayName,omitempty"`
  1168. // Id: The identifier for this User.
  1169. Id string `json:"id,omitempty"`
  1170. // Kind: The kind of this entity. Always blogger#user
  1171. Kind string `json:"kind,omitempty"`
  1172. // Locale: This user's locale
  1173. Locale *UserLocale `json:"locale,omitempty"`
  1174. // SelfLink: The API REST URL to fetch this resource from.
  1175. SelfLink string `json:"selfLink,omitempty"`
  1176. // Url: The user's profile page.
  1177. Url string `json:"url,omitempty"`
  1178. // ServerResponse contains the HTTP response code and headers from the
  1179. // server.
  1180. googleapi.ServerResponse `json:"-"`
  1181. // ForceSendFields is a list of field names (e.g. "About") to
  1182. // unconditionally include in API requests. By default, fields with
  1183. // empty values are omitted from API requests. However, any non-pointer,
  1184. // non-interface field appearing in ForceSendFields will be sent to the
  1185. // server regardless of whether the field is empty or not. This may be
  1186. // used to include empty fields in Patch requests.
  1187. ForceSendFields []string `json:"-"`
  1188. // NullFields is a list of field names (e.g. "About") to include in API
  1189. // requests with the JSON null value. By default, fields with empty
  1190. // values are omitted from API requests. However, any field with an
  1191. // empty value appearing in NullFields will be sent to the server as
  1192. // null. It is an error if a field in this list has a non-empty value.
  1193. // This may be used to include null fields in Patch requests.
  1194. NullFields []string `json:"-"`
  1195. }
  1196. func (s *User) MarshalJSON() ([]byte, error) {
  1197. type NoMethod User
  1198. raw := NoMethod(*s)
  1199. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1200. }
  1201. // UserBlogs: The container of blogs for this user.
  1202. type UserBlogs struct {
  1203. // SelfLink: The URL of the Blogs for this user.
  1204. SelfLink string `json:"selfLink,omitempty"`
  1205. // ForceSendFields is a list of field names (e.g. "SelfLink") to
  1206. // unconditionally include in API requests. By default, fields with
  1207. // empty values are omitted from API requests. However, any non-pointer,
  1208. // non-interface field appearing in ForceSendFields will be sent to the
  1209. // server regardless of whether the field is empty or not. This may be
  1210. // used to include empty fields in Patch requests.
  1211. ForceSendFields []string `json:"-"`
  1212. // NullFields is a list of field names (e.g. "SelfLink") to include in
  1213. // API requests with the JSON null value. By default, fields with empty
  1214. // values are omitted from API requests. However, any field with an
  1215. // empty value appearing in NullFields will be sent to the server as
  1216. // null. It is an error if a field in this list has a non-empty value.
  1217. // This may be used to include null fields in Patch requests.
  1218. NullFields []string `json:"-"`
  1219. }
  1220. func (s *UserBlogs) MarshalJSON() ([]byte, error) {
  1221. type NoMethod UserBlogs
  1222. raw := NoMethod(*s)
  1223. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1224. }
  1225. // UserLocale: This user's locale
  1226. type UserLocale struct {
  1227. // Country: The user's country setting.
  1228. Country string `json:"country,omitempty"`
  1229. // Language: The user's language setting.
  1230. Language string `json:"language,omitempty"`
  1231. // Variant: The user's language variant setting.
  1232. Variant string `json:"variant,omitempty"`
  1233. // ForceSendFields is a list of field names (e.g. "Country") to
  1234. // unconditionally include in API requests. By default, fields with
  1235. // empty values are omitted from API requests. However, any non-pointer,
  1236. // non-interface field appearing in ForceSendFields will be sent to the
  1237. // server regardless of whether the field is empty or not. This may be
  1238. // used to include empty fields in Patch requests.
  1239. ForceSendFields []string `json:"-"`
  1240. // NullFields is a list of field names (e.g. "Country") to include in
  1241. // API requests with the JSON null value. By default, fields with empty
  1242. // values are omitted from API requests. However, any field with an
  1243. // empty value appearing in NullFields will be sent to the server as
  1244. // null. It is an error if a field in this list has a non-empty value.
  1245. // This may be used to include null fields in Patch requests.
  1246. NullFields []string `json:"-"`
  1247. }
  1248. func (s *UserLocale) MarshalJSON() ([]byte, error) {
  1249. type NoMethod UserLocale
  1250. raw := NoMethod(*s)
  1251. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1252. }
  1253. // method id "blogger.blogUserInfos.get":
  1254. type BlogUserInfosGetCall struct {
  1255. s *Service
  1256. userId string
  1257. blogId string
  1258. urlParams_ gensupport.URLParams
  1259. ifNoneMatch_ string
  1260. ctx_ context.Context
  1261. header_ http.Header
  1262. }
  1263. // Get: Gets one blog and user info pair by blogId and userId.
  1264. func (r *BlogUserInfosService) Get(userId string, blogId string) *BlogUserInfosGetCall {
  1265. c := &BlogUserInfosGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1266. c.userId = userId
  1267. c.blogId = blogId
  1268. return c
  1269. }
  1270. // MaxPosts sets the optional parameter "maxPosts": Maximum number of
  1271. // posts to pull back with the blog.
  1272. func (c *BlogUserInfosGetCall) MaxPosts(maxPosts int64) *BlogUserInfosGetCall {
  1273. c.urlParams_.Set("maxPosts", fmt.Sprint(maxPosts))
  1274. return c
  1275. }
  1276. // Fields allows partial responses to be retrieved. See
  1277. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1278. // for more information.
  1279. func (c *BlogUserInfosGetCall) Fields(s ...googleapi.Field) *BlogUserInfosGetCall {
  1280. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1281. return c
  1282. }
  1283. // IfNoneMatch sets the optional parameter which makes the operation
  1284. // fail if the object's ETag matches the given value. This is useful for
  1285. // getting updates only after the object has changed since the last
  1286. // request. Use googleapi.IsNotModified to check whether the response
  1287. // error from Do is the result of In-None-Match.
  1288. func (c *BlogUserInfosGetCall) IfNoneMatch(entityTag string) *BlogUserInfosGetCall {
  1289. c.ifNoneMatch_ = entityTag
  1290. return c
  1291. }
  1292. // Context sets the context to be used in this call's Do method. Any
  1293. // pending HTTP request will be aborted if the provided context is
  1294. // canceled.
  1295. func (c *BlogUserInfosGetCall) Context(ctx context.Context) *BlogUserInfosGetCall {
  1296. c.ctx_ = ctx
  1297. return c
  1298. }
  1299. // Header returns an http.Header that can be modified by the caller to
  1300. // add HTTP headers to the request.
  1301. func (c *BlogUserInfosGetCall) Header() http.Header {
  1302. if c.header_ == nil {
  1303. c.header_ = make(http.Header)
  1304. }
  1305. return c.header_
  1306. }
  1307. func (c *BlogUserInfosGetCall) doRequest(alt string) (*http.Response, error) {
  1308. reqHeaders := make(http.Header)
  1309. for k, v := range c.header_ {
  1310. reqHeaders[k] = v
  1311. }
  1312. reqHeaders.Set("User-Agent", c.s.userAgent())
  1313. if c.ifNoneMatch_ != "" {
  1314. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1315. }
  1316. var body io.Reader = nil
  1317. c.urlParams_.Set("alt", alt)
  1318. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs/{blogId}")
  1319. urls += "?" + c.urlParams_.Encode()
  1320. req, _ := http.NewRequest("GET", urls, body)
  1321. req.Header = reqHeaders
  1322. googleapi.Expand(req.URL, map[string]string{
  1323. "userId": c.userId,
  1324. "blogId": c.blogId,
  1325. })
  1326. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1327. }
  1328. // Do executes the "blogger.blogUserInfos.get" call.
  1329. // Exactly one of *BlogUserInfo or error will be non-nil. Any non-2xx
  1330. // status code is an error. Response headers are in either
  1331. // *BlogUserInfo.ServerResponse.Header or (if a response was returned at
  1332. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1333. // to check whether the returned error was because
  1334. // http.StatusNotModified was returned.
  1335. func (c *BlogUserInfosGetCall) Do(opts ...googleapi.CallOption) (*BlogUserInfo, error) {
  1336. gensupport.SetOptions(c.urlParams_, opts...)
  1337. res, err := c.doRequest("json")
  1338. if res != nil && res.StatusCode == http.StatusNotModified {
  1339. if res.Body != nil {
  1340. res.Body.Close()
  1341. }
  1342. return nil, &googleapi.Error{
  1343. Code: res.StatusCode,
  1344. Header: res.Header,
  1345. }
  1346. }
  1347. if err != nil {
  1348. return nil, err
  1349. }
  1350. defer googleapi.CloseBody(res)
  1351. if err := googleapi.CheckResponse(res); err != nil {
  1352. return nil, err
  1353. }
  1354. ret := &BlogUserInfo{
  1355. ServerResponse: googleapi.ServerResponse{
  1356. Header: res.Header,
  1357. HTTPStatusCode: res.StatusCode,
  1358. },
  1359. }
  1360. target := &ret
  1361. if err := gensupport.DecodeResponse(target, res); err != nil {
  1362. return nil, err
  1363. }
  1364. return ret, nil
  1365. // {
  1366. // "description": "Gets one blog and user info pair by blogId and userId.",
  1367. // "httpMethod": "GET",
  1368. // "id": "blogger.blogUserInfos.get",
  1369. // "parameterOrder": [
  1370. // "userId",
  1371. // "blogId"
  1372. // ],
  1373. // "parameters": {
  1374. // "blogId": {
  1375. // "description": "The ID of the blog to get.",
  1376. // "location": "path",
  1377. // "required": true,
  1378. // "type": "string"
  1379. // },
  1380. // "maxPosts": {
  1381. // "description": "Maximum number of posts to pull back with the blog.",
  1382. // "format": "uint32",
  1383. // "location": "query",
  1384. // "type": "integer"
  1385. // },
  1386. // "userId": {
  1387. // "description": "ID of the user whose blogs are to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  1388. // "location": "path",
  1389. // "required": true,
  1390. // "type": "string"
  1391. // }
  1392. // },
  1393. // "path": "users/{userId}/blogs/{blogId}",
  1394. // "response": {
  1395. // "$ref": "BlogUserInfo"
  1396. // },
  1397. // "scopes": [
  1398. // "https://www.googleapis.com/auth/blogger",
  1399. // "https://www.googleapis.com/auth/blogger.readonly"
  1400. // ]
  1401. // }
  1402. }
  1403. // method id "blogger.blogs.get":
  1404. type BlogsGetCall struct {
  1405. s *Service
  1406. blogId string
  1407. urlParams_ gensupport.URLParams
  1408. ifNoneMatch_ string
  1409. ctx_ context.Context
  1410. header_ http.Header
  1411. }
  1412. // Get: Gets one blog by ID.
  1413. func (r *BlogsService) Get(blogId string) *BlogsGetCall {
  1414. c := &BlogsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1415. c.blogId = blogId
  1416. return c
  1417. }
  1418. // MaxPosts sets the optional parameter "maxPosts": Maximum number of
  1419. // posts to pull back with the blog.
  1420. func (c *BlogsGetCall) MaxPosts(maxPosts int64) *BlogsGetCall {
  1421. c.urlParams_.Set("maxPosts", fmt.Sprint(maxPosts))
  1422. return c
  1423. }
  1424. // View sets the optional parameter "view": Access level with which to
  1425. // view the blog. Note that some fields require elevated access.
  1426. //
  1427. // Possible values:
  1428. // "ADMIN" - Admin level detail.
  1429. // "AUTHOR" - Author level detail.
  1430. // "READER" - Reader level detail.
  1431. func (c *BlogsGetCall) View(view string) *BlogsGetCall {
  1432. c.urlParams_.Set("view", view)
  1433. return c
  1434. }
  1435. // Fields allows partial responses to be retrieved. See
  1436. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1437. // for more information.
  1438. func (c *BlogsGetCall) Fields(s ...googleapi.Field) *BlogsGetCall {
  1439. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1440. return c
  1441. }
  1442. // IfNoneMatch sets the optional parameter which makes the operation
  1443. // fail if the object's ETag matches the given value. This is useful for
  1444. // getting updates only after the object has changed since the last
  1445. // request. Use googleapi.IsNotModified to check whether the response
  1446. // error from Do is the result of In-None-Match.
  1447. func (c *BlogsGetCall) IfNoneMatch(entityTag string) *BlogsGetCall {
  1448. c.ifNoneMatch_ = entityTag
  1449. return c
  1450. }
  1451. // Context sets the context to be used in this call's Do method. Any
  1452. // pending HTTP request will be aborted if the provided context is
  1453. // canceled.
  1454. func (c *BlogsGetCall) Context(ctx context.Context) *BlogsGetCall {
  1455. c.ctx_ = ctx
  1456. return c
  1457. }
  1458. // Header returns an http.Header that can be modified by the caller to
  1459. // add HTTP headers to the request.
  1460. func (c *BlogsGetCall) Header() http.Header {
  1461. if c.header_ == nil {
  1462. c.header_ = make(http.Header)
  1463. }
  1464. return c.header_
  1465. }
  1466. func (c *BlogsGetCall) doRequest(alt string) (*http.Response, error) {
  1467. reqHeaders := make(http.Header)
  1468. for k, v := range c.header_ {
  1469. reqHeaders[k] = v
  1470. }
  1471. reqHeaders.Set("User-Agent", c.s.userAgent())
  1472. if c.ifNoneMatch_ != "" {
  1473. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1474. }
  1475. var body io.Reader = nil
  1476. c.urlParams_.Set("alt", alt)
  1477. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}")
  1478. urls += "?" + c.urlParams_.Encode()
  1479. req, _ := http.NewRequest("GET", urls, body)
  1480. req.Header = reqHeaders
  1481. googleapi.Expand(req.URL, map[string]string{
  1482. "blogId": c.blogId,
  1483. })
  1484. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1485. }
  1486. // Do executes the "blogger.blogs.get" call.
  1487. // Exactly one of *Blog or error will be non-nil. Any non-2xx status
  1488. // code is an error. Response headers are in either
  1489. // *Blog.ServerResponse.Header or (if a response was returned at all) in
  1490. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1491. // whether the returned error was because http.StatusNotModified was
  1492. // returned.
  1493. func (c *BlogsGetCall) Do(opts ...googleapi.CallOption) (*Blog, error) {
  1494. gensupport.SetOptions(c.urlParams_, opts...)
  1495. res, err := c.doRequest("json")
  1496. if res != nil && res.StatusCode == http.StatusNotModified {
  1497. if res.Body != nil {
  1498. res.Body.Close()
  1499. }
  1500. return nil, &googleapi.Error{
  1501. Code: res.StatusCode,
  1502. Header: res.Header,
  1503. }
  1504. }
  1505. if err != nil {
  1506. return nil, err
  1507. }
  1508. defer googleapi.CloseBody(res)
  1509. if err := googleapi.CheckResponse(res); err != nil {
  1510. return nil, err
  1511. }
  1512. ret := &Blog{
  1513. ServerResponse: googleapi.ServerResponse{
  1514. Header: res.Header,
  1515. HTTPStatusCode: res.StatusCode,
  1516. },
  1517. }
  1518. target := &ret
  1519. if err := gensupport.DecodeResponse(target, res); err != nil {
  1520. return nil, err
  1521. }
  1522. return ret, nil
  1523. // {
  1524. // "description": "Gets one blog by ID.",
  1525. // "httpMethod": "GET",
  1526. // "id": "blogger.blogs.get",
  1527. // "parameterOrder": [
  1528. // "blogId"
  1529. // ],
  1530. // "parameters": {
  1531. // "blogId": {
  1532. // "description": "The ID of the blog to get.",
  1533. // "location": "path",
  1534. // "required": true,
  1535. // "type": "string"
  1536. // },
  1537. // "maxPosts": {
  1538. // "description": "Maximum number of posts to pull back with the blog.",
  1539. // "format": "uint32",
  1540. // "location": "query",
  1541. // "type": "integer"
  1542. // },
  1543. // "view": {
  1544. // "description": "Access level with which to view the blog. Note that some fields require elevated access.",
  1545. // "enum": [
  1546. // "ADMIN",
  1547. // "AUTHOR",
  1548. // "READER"
  1549. // ],
  1550. // "enumDescriptions": [
  1551. // "Admin level detail.",
  1552. // "Author level detail.",
  1553. // "Reader level detail."
  1554. // ],
  1555. // "location": "query",
  1556. // "type": "string"
  1557. // }
  1558. // },
  1559. // "path": "blogs/{blogId}",
  1560. // "response": {
  1561. // "$ref": "Blog"
  1562. // },
  1563. // "scopes": [
  1564. // "https://www.googleapis.com/auth/blogger",
  1565. // "https://www.googleapis.com/auth/blogger.readonly"
  1566. // ]
  1567. // }
  1568. }
  1569. // method id "blogger.blogs.getByUrl":
  1570. type BlogsGetByUrlCall struct {
  1571. s *Service
  1572. urlParams_ gensupport.URLParams
  1573. ifNoneMatch_ string
  1574. ctx_ context.Context
  1575. header_ http.Header
  1576. }
  1577. // GetByUrl: Retrieve a Blog by URL.
  1578. func (r *BlogsService) GetByUrl(url string) *BlogsGetByUrlCall {
  1579. c := &BlogsGetByUrlCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1580. c.urlParams_.Set("url", url)
  1581. return c
  1582. }
  1583. // View sets the optional parameter "view": Access level with which to
  1584. // view the blog. Note that some fields require elevated access.
  1585. //
  1586. // Possible values:
  1587. // "ADMIN" - Admin level detail.
  1588. // "AUTHOR" - Author level detail.
  1589. // "READER" - Reader level detail.
  1590. func (c *BlogsGetByUrlCall) View(view string) *BlogsGetByUrlCall {
  1591. c.urlParams_.Set("view", view)
  1592. return c
  1593. }
  1594. // Fields allows partial responses to be retrieved. See
  1595. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1596. // for more information.
  1597. func (c *BlogsGetByUrlCall) Fields(s ...googleapi.Field) *BlogsGetByUrlCall {
  1598. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1599. return c
  1600. }
  1601. // IfNoneMatch sets the optional parameter which makes the operation
  1602. // fail if the object's ETag matches the given value. This is useful for
  1603. // getting updates only after the object has changed since the last
  1604. // request. Use googleapi.IsNotModified to check whether the response
  1605. // error from Do is the result of In-None-Match.
  1606. func (c *BlogsGetByUrlCall) IfNoneMatch(entityTag string) *BlogsGetByUrlCall {
  1607. c.ifNoneMatch_ = entityTag
  1608. return c
  1609. }
  1610. // Context sets the context to be used in this call's Do method. Any
  1611. // pending HTTP request will be aborted if the provided context is
  1612. // canceled.
  1613. func (c *BlogsGetByUrlCall) Context(ctx context.Context) *BlogsGetByUrlCall {
  1614. c.ctx_ = ctx
  1615. return c
  1616. }
  1617. // Header returns an http.Header that can be modified by the caller to
  1618. // add HTTP headers to the request.
  1619. func (c *BlogsGetByUrlCall) Header() http.Header {
  1620. if c.header_ == nil {
  1621. c.header_ = make(http.Header)
  1622. }
  1623. return c.header_
  1624. }
  1625. func (c *BlogsGetByUrlCall) doRequest(alt string) (*http.Response, error) {
  1626. reqHeaders := make(http.Header)
  1627. for k, v := range c.header_ {
  1628. reqHeaders[k] = v
  1629. }
  1630. reqHeaders.Set("User-Agent", c.s.userAgent())
  1631. if c.ifNoneMatch_ != "" {
  1632. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1633. }
  1634. var body io.Reader = nil
  1635. c.urlParams_.Set("alt", alt)
  1636. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/byurl")
  1637. urls += "?" + c.urlParams_.Encode()
  1638. req, _ := http.NewRequest("GET", urls, body)
  1639. req.Header = reqHeaders
  1640. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1641. }
  1642. // Do executes the "blogger.blogs.getByUrl" call.
  1643. // Exactly one of *Blog or error will be non-nil. Any non-2xx status
  1644. // code is an error. Response headers are in either
  1645. // *Blog.ServerResponse.Header or (if a response was returned at all) in
  1646. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1647. // whether the returned error was because http.StatusNotModified was
  1648. // returned.
  1649. func (c *BlogsGetByUrlCall) Do(opts ...googleapi.CallOption) (*Blog, error) {
  1650. gensupport.SetOptions(c.urlParams_, opts...)
  1651. res, err := c.doRequest("json")
  1652. if res != nil && res.StatusCode == http.StatusNotModified {
  1653. if res.Body != nil {
  1654. res.Body.Close()
  1655. }
  1656. return nil, &googleapi.Error{
  1657. Code: res.StatusCode,
  1658. Header: res.Header,
  1659. }
  1660. }
  1661. if err != nil {
  1662. return nil, err
  1663. }
  1664. defer googleapi.CloseBody(res)
  1665. if err := googleapi.CheckResponse(res); err != nil {
  1666. return nil, err
  1667. }
  1668. ret := &Blog{
  1669. ServerResponse: googleapi.ServerResponse{
  1670. Header: res.Header,
  1671. HTTPStatusCode: res.StatusCode,
  1672. },
  1673. }
  1674. target := &ret
  1675. if err := gensupport.DecodeResponse(target, res); err != nil {
  1676. return nil, err
  1677. }
  1678. return ret, nil
  1679. // {
  1680. // "description": "Retrieve a Blog by URL.",
  1681. // "httpMethod": "GET",
  1682. // "id": "blogger.blogs.getByUrl",
  1683. // "parameterOrder": [
  1684. // "url"
  1685. // ],
  1686. // "parameters": {
  1687. // "url": {
  1688. // "description": "The URL of the blog to retrieve.",
  1689. // "location": "query",
  1690. // "required": true,
  1691. // "type": "string"
  1692. // },
  1693. // "view": {
  1694. // "description": "Access level with which to view the blog. Note that some fields require elevated access.",
  1695. // "enum": [
  1696. // "ADMIN",
  1697. // "AUTHOR",
  1698. // "READER"
  1699. // ],
  1700. // "enumDescriptions": [
  1701. // "Admin level detail.",
  1702. // "Author level detail.",
  1703. // "Reader level detail."
  1704. // ],
  1705. // "location": "query",
  1706. // "type": "string"
  1707. // }
  1708. // },
  1709. // "path": "blogs/byurl",
  1710. // "response": {
  1711. // "$ref": "Blog"
  1712. // },
  1713. // "scopes": [
  1714. // "https://www.googleapis.com/auth/blogger",
  1715. // "https://www.googleapis.com/auth/blogger.readonly"
  1716. // ]
  1717. // }
  1718. }
  1719. // method id "blogger.blogs.listByUser":
  1720. type BlogsListByUserCall struct {
  1721. s *Service
  1722. userId string
  1723. urlParams_ gensupport.URLParams
  1724. ifNoneMatch_ string
  1725. ctx_ context.Context
  1726. header_ http.Header
  1727. }
  1728. // ListByUser: Retrieves a list of blogs, possibly filtered.
  1729. func (r *BlogsService) ListByUser(userId string) *BlogsListByUserCall {
  1730. c := &BlogsListByUserCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1731. c.userId = userId
  1732. return c
  1733. }
  1734. // FetchUserInfo sets the optional parameter "fetchUserInfo": Whether
  1735. // the response is a list of blogs with per-user information instead of
  1736. // just blogs.
  1737. func (c *BlogsListByUserCall) FetchUserInfo(fetchUserInfo bool) *BlogsListByUserCall {
  1738. c.urlParams_.Set("fetchUserInfo", fmt.Sprint(fetchUserInfo))
  1739. return c
  1740. }
  1741. // Role sets the optional parameter "role": User access types for blogs
  1742. // to include in the results, e.g. AUTHOR will return blogs where the
  1743. // user has author level access. If no roles are specified, defaults to
  1744. // ADMIN and AUTHOR roles.
  1745. //
  1746. // Possible values:
  1747. // "ADMIN" - Admin role - Blogs where the user has Admin level access.
  1748. // "AUTHOR" - Author role - Blogs where the user has Author level
  1749. // access.
  1750. // "READER" - Reader role - Blogs where the user has Reader level
  1751. // access (to a private blog).
  1752. func (c *BlogsListByUserCall) Role(role ...string) *BlogsListByUserCall {
  1753. c.urlParams_.SetMulti("role", append([]string{}, role...))
  1754. return c
  1755. }
  1756. // Status sets the optional parameter "status": Blog statuses to include
  1757. // in the result (default: Live blogs only). Note that ADMIN access is
  1758. // required to view deleted blogs.
  1759. //
  1760. // Possible values:
  1761. // "DELETED" - Blog has been deleted by an administrator.
  1762. // "LIVE" (default) - Blog is currently live.
  1763. func (c *BlogsListByUserCall) Status(status ...string) *BlogsListByUserCall {
  1764. c.urlParams_.SetMulti("status", append([]string{}, status...))
  1765. return c
  1766. }
  1767. // View sets the optional parameter "view": Access level with which to
  1768. // view the blogs. Note that some fields require elevated access.
  1769. //
  1770. // Possible values:
  1771. // "ADMIN" - Admin level detail.
  1772. // "AUTHOR" - Author level detail.
  1773. // "READER" - Reader level detail.
  1774. func (c *BlogsListByUserCall) View(view string) *BlogsListByUserCall {
  1775. c.urlParams_.Set("view", view)
  1776. return c
  1777. }
  1778. // Fields allows partial responses to be retrieved. See
  1779. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1780. // for more information.
  1781. func (c *BlogsListByUserCall) Fields(s ...googleapi.Field) *BlogsListByUserCall {
  1782. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1783. return c
  1784. }
  1785. // IfNoneMatch sets the optional parameter which makes the operation
  1786. // fail if the object's ETag matches the given value. This is useful for
  1787. // getting updates only after the object has changed since the last
  1788. // request. Use googleapi.IsNotModified to check whether the response
  1789. // error from Do is the result of In-None-Match.
  1790. func (c *BlogsListByUserCall) IfNoneMatch(entityTag string) *BlogsListByUserCall {
  1791. c.ifNoneMatch_ = entityTag
  1792. return c
  1793. }
  1794. // Context sets the context to be used in this call's Do method. Any
  1795. // pending HTTP request will be aborted if the provided context is
  1796. // canceled.
  1797. func (c *BlogsListByUserCall) Context(ctx context.Context) *BlogsListByUserCall {
  1798. c.ctx_ = ctx
  1799. return c
  1800. }
  1801. // Header returns an http.Header that can be modified by the caller to
  1802. // add HTTP headers to the request.
  1803. func (c *BlogsListByUserCall) Header() http.Header {
  1804. if c.header_ == nil {
  1805. c.header_ = make(http.Header)
  1806. }
  1807. return c.header_
  1808. }
  1809. func (c *BlogsListByUserCall) doRequest(alt string) (*http.Response, error) {
  1810. reqHeaders := make(http.Header)
  1811. for k, v := range c.header_ {
  1812. reqHeaders[k] = v
  1813. }
  1814. reqHeaders.Set("User-Agent", c.s.userAgent())
  1815. if c.ifNoneMatch_ != "" {
  1816. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1817. }
  1818. var body io.Reader = nil
  1819. c.urlParams_.Set("alt", alt)
  1820. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs")
  1821. urls += "?" + c.urlParams_.Encode()
  1822. req, _ := http.NewRequest("GET", urls, body)
  1823. req.Header = reqHeaders
  1824. googleapi.Expand(req.URL, map[string]string{
  1825. "userId": c.userId,
  1826. })
  1827. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1828. }
  1829. // Do executes the "blogger.blogs.listByUser" call.
  1830. // Exactly one of *BlogList or error will be non-nil. Any non-2xx status
  1831. // code is an error. Response headers are in either
  1832. // *BlogList.ServerResponse.Header or (if a response was returned at
  1833. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1834. // to check whether the returned error was because
  1835. // http.StatusNotModified was returned.
  1836. func (c *BlogsListByUserCall) Do(opts ...googleapi.CallOption) (*BlogList, error) {
  1837. gensupport.SetOptions(c.urlParams_, opts...)
  1838. res, err := c.doRequest("json")
  1839. if res != nil && res.StatusCode == http.StatusNotModified {
  1840. if res.Body != nil {
  1841. res.Body.Close()
  1842. }
  1843. return nil, &googleapi.Error{
  1844. Code: res.StatusCode,
  1845. Header: res.Header,
  1846. }
  1847. }
  1848. if err != nil {
  1849. return nil, err
  1850. }
  1851. defer googleapi.CloseBody(res)
  1852. if err := googleapi.CheckResponse(res); err != nil {
  1853. return nil, err
  1854. }
  1855. ret := &BlogList{
  1856. ServerResponse: googleapi.ServerResponse{
  1857. Header: res.Header,
  1858. HTTPStatusCode: res.StatusCode,
  1859. },
  1860. }
  1861. target := &ret
  1862. if err := gensupport.DecodeResponse(target, res); err != nil {
  1863. return nil, err
  1864. }
  1865. return ret, nil
  1866. // {
  1867. // "description": "Retrieves a list of blogs, possibly filtered.",
  1868. // "httpMethod": "GET",
  1869. // "id": "blogger.blogs.listByUser",
  1870. // "parameterOrder": [
  1871. // "userId"
  1872. // ],
  1873. // "parameters": {
  1874. // "fetchUserInfo": {
  1875. // "description": "Whether the response is a list of blogs with per-user information instead of just blogs.",
  1876. // "location": "query",
  1877. // "type": "boolean"
  1878. // },
  1879. // "role": {
  1880. // "description": "User access types for blogs to include in the results, e.g. AUTHOR will return blogs where the user has author level access. If no roles are specified, defaults to ADMIN and AUTHOR roles.",
  1881. // "enum": [
  1882. // "ADMIN",
  1883. // "AUTHOR",
  1884. // "READER"
  1885. // ],
  1886. // "enumDescriptions": [
  1887. // "Admin role - Blogs where the user has Admin level access.",
  1888. // "Author role - Blogs where the user has Author level access.",
  1889. // "Reader role - Blogs where the user has Reader level access (to a private blog)."
  1890. // ],
  1891. // "location": "query",
  1892. // "repeated": true,
  1893. // "type": "string"
  1894. // },
  1895. // "status": {
  1896. // "default": "LIVE",
  1897. // "description": "Blog statuses to include in the result (default: Live blogs only). Note that ADMIN access is required to view deleted blogs.",
  1898. // "enum": [
  1899. // "DELETED",
  1900. // "LIVE"
  1901. // ],
  1902. // "enumDescriptions": [
  1903. // "Blog has been deleted by an administrator.",
  1904. // "Blog is currently live."
  1905. // ],
  1906. // "location": "query",
  1907. // "repeated": true,
  1908. // "type": "string"
  1909. // },
  1910. // "userId": {
  1911. // "description": "ID of the user whose blogs are to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  1912. // "location": "path",
  1913. // "required": true,
  1914. // "type": "string"
  1915. // },
  1916. // "view": {
  1917. // "description": "Access level with which to view the blogs. Note that some fields require elevated access.",
  1918. // "enum": [
  1919. // "ADMIN",
  1920. // "AUTHOR",
  1921. // "READER"
  1922. // ],
  1923. // "enumDescriptions": [
  1924. // "Admin level detail.",
  1925. // "Author level detail.",
  1926. // "Reader level detail."
  1927. // ],
  1928. // "location": "query",
  1929. // "type": "string"
  1930. // }
  1931. // },
  1932. // "path": "users/{userId}/blogs",
  1933. // "response": {
  1934. // "$ref": "BlogList"
  1935. // },
  1936. // "scopes": [
  1937. // "https://www.googleapis.com/auth/blogger",
  1938. // "https://www.googleapis.com/auth/blogger.readonly"
  1939. // ]
  1940. // }
  1941. }
  1942. // method id "blogger.comments.approve":
  1943. type CommentsApproveCall struct {
  1944. s *Service
  1945. blogId string
  1946. postId string
  1947. commentId string
  1948. urlParams_ gensupport.URLParams
  1949. ctx_ context.Context
  1950. header_ http.Header
  1951. }
  1952. // Approve: Marks a comment as not spam.
  1953. func (r *CommentsService) Approve(blogId string, postId string, commentId string) *CommentsApproveCall {
  1954. c := &CommentsApproveCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1955. c.blogId = blogId
  1956. c.postId = postId
  1957. c.commentId = commentId
  1958. return c
  1959. }
  1960. // Fields allows partial responses to be retrieved. See
  1961. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1962. // for more information.
  1963. func (c *CommentsApproveCall) Fields(s ...googleapi.Field) *CommentsApproveCall {
  1964. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1965. return c
  1966. }
  1967. // Context sets the context to be used in this call's Do method. Any
  1968. // pending HTTP request will be aborted if the provided context is
  1969. // canceled.
  1970. func (c *CommentsApproveCall) Context(ctx context.Context) *CommentsApproveCall {
  1971. c.ctx_ = ctx
  1972. return c
  1973. }
  1974. // Header returns an http.Header that can be modified by the caller to
  1975. // add HTTP headers to the request.
  1976. func (c *CommentsApproveCall) Header() http.Header {
  1977. if c.header_ == nil {
  1978. c.header_ = make(http.Header)
  1979. }
  1980. return c.header_
  1981. }
  1982. func (c *CommentsApproveCall) doRequest(alt string) (*http.Response, error) {
  1983. reqHeaders := make(http.Header)
  1984. for k, v := range c.header_ {
  1985. reqHeaders[k] = v
  1986. }
  1987. reqHeaders.Set("User-Agent", c.s.userAgent())
  1988. var body io.Reader = nil
  1989. c.urlParams_.Set("alt", alt)
  1990. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}/approve")
  1991. urls += "?" + c.urlParams_.Encode()
  1992. req, _ := http.NewRequest("POST", urls, body)
  1993. req.Header = reqHeaders
  1994. googleapi.Expand(req.URL, map[string]string{
  1995. "blogId": c.blogId,
  1996. "postId": c.postId,
  1997. "commentId": c.commentId,
  1998. })
  1999. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2000. }
  2001. // Do executes the "blogger.comments.approve" call.
  2002. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  2003. // code is an error. Response headers are in either
  2004. // *Comment.ServerResponse.Header or (if a response was returned at all)
  2005. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2006. // check whether the returned error was because http.StatusNotModified
  2007. // was returned.
  2008. func (c *CommentsApproveCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  2009. gensupport.SetOptions(c.urlParams_, opts...)
  2010. res, err := c.doRequest("json")
  2011. if res != nil && res.StatusCode == http.StatusNotModified {
  2012. if res.Body != nil {
  2013. res.Body.Close()
  2014. }
  2015. return nil, &googleapi.Error{
  2016. Code: res.StatusCode,
  2017. Header: res.Header,
  2018. }
  2019. }
  2020. if err != nil {
  2021. return nil, err
  2022. }
  2023. defer googleapi.CloseBody(res)
  2024. if err := googleapi.CheckResponse(res); err != nil {
  2025. return nil, err
  2026. }
  2027. ret := &Comment{
  2028. ServerResponse: googleapi.ServerResponse{
  2029. Header: res.Header,
  2030. HTTPStatusCode: res.StatusCode,
  2031. },
  2032. }
  2033. target := &ret
  2034. if err := gensupport.DecodeResponse(target, res); err != nil {
  2035. return nil, err
  2036. }
  2037. return ret, nil
  2038. // {
  2039. // "description": "Marks a comment as not spam.",
  2040. // "httpMethod": "POST",
  2041. // "id": "blogger.comments.approve",
  2042. // "parameterOrder": [
  2043. // "blogId",
  2044. // "postId",
  2045. // "commentId"
  2046. // ],
  2047. // "parameters": {
  2048. // "blogId": {
  2049. // "description": "The ID of the Blog.",
  2050. // "location": "path",
  2051. // "required": true,
  2052. // "type": "string"
  2053. // },
  2054. // "commentId": {
  2055. // "description": "The ID of the comment to mark as not spam.",
  2056. // "location": "path",
  2057. // "required": true,
  2058. // "type": "string"
  2059. // },
  2060. // "postId": {
  2061. // "description": "The ID of the Post.",
  2062. // "location": "path",
  2063. // "required": true,
  2064. // "type": "string"
  2065. // }
  2066. // },
  2067. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}/approve",
  2068. // "response": {
  2069. // "$ref": "Comment"
  2070. // },
  2071. // "scopes": [
  2072. // "https://www.googleapis.com/auth/blogger"
  2073. // ]
  2074. // }
  2075. }
  2076. // method id "blogger.comments.delete":
  2077. type CommentsDeleteCall struct {
  2078. s *Service
  2079. blogId string
  2080. postId string
  2081. commentId string
  2082. urlParams_ gensupport.URLParams
  2083. ctx_ context.Context
  2084. header_ http.Header
  2085. }
  2086. // Delete: Delete a comment by ID.
  2087. func (r *CommentsService) Delete(blogId string, postId string, commentId string) *CommentsDeleteCall {
  2088. c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2089. c.blogId = blogId
  2090. c.postId = postId
  2091. c.commentId = commentId
  2092. return c
  2093. }
  2094. // Fields allows partial responses to be retrieved. See
  2095. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2096. // for more information.
  2097. func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall {
  2098. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2099. return c
  2100. }
  2101. // Context sets the context to be used in this call's Do method. Any
  2102. // pending HTTP request will be aborted if the provided context is
  2103. // canceled.
  2104. func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall {
  2105. c.ctx_ = ctx
  2106. return c
  2107. }
  2108. // Header returns an http.Header that can be modified by the caller to
  2109. // add HTTP headers to the request.
  2110. func (c *CommentsDeleteCall) Header() http.Header {
  2111. if c.header_ == nil {
  2112. c.header_ = make(http.Header)
  2113. }
  2114. return c.header_
  2115. }
  2116. func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2117. reqHeaders := make(http.Header)
  2118. for k, v := range c.header_ {
  2119. reqHeaders[k] = v
  2120. }
  2121. reqHeaders.Set("User-Agent", c.s.userAgent())
  2122. var body io.Reader = nil
  2123. c.urlParams_.Set("alt", alt)
  2124. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}")
  2125. urls += "?" + c.urlParams_.Encode()
  2126. req, _ := http.NewRequest("DELETE", urls, body)
  2127. req.Header = reqHeaders
  2128. googleapi.Expand(req.URL, map[string]string{
  2129. "blogId": c.blogId,
  2130. "postId": c.postId,
  2131. "commentId": c.commentId,
  2132. })
  2133. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2134. }
  2135. // Do executes the "blogger.comments.delete" call.
  2136. func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2137. gensupport.SetOptions(c.urlParams_, opts...)
  2138. res, err := c.doRequest("json")
  2139. if err != nil {
  2140. return err
  2141. }
  2142. defer googleapi.CloseBody(res)
  2143. if err := googleapi.CheckResponse(res); err != nil {
  2144. return err
  2145. }
  2146. return nil
  2147. // {
  2148. // "description": "Delete a comment by ID.",
  2149. // "httpMethod": "DELETE",
  2150. // "id": "blogger.comments.delete",
  2151. // "parameterOrder": [
  2152. // "blogId",
  2153. // "postId",
  2154. // "commentId"
  2155. // ],
  2156. // "parameters": {
  2157. // "blogId": {
  2158. // "description": "The ID of the Blog.",
  2159. // "location": "path",
  2160. // "required": true,
  2161. // "type": "string"
  2162. // },
  2163. // "commentId": {
  2164. // "description": "The ID of the comment to delete.",
  2165. // "location": "path",
  2166. // "required": true,
  2167. // "type": "string"
  2168. // },
  2169. // "postId": {
  2170. // "description": "The ID of the Post.",
  2171. // "location": "path",
  2172. // "required": true,
  2173. // "type": "string"
  2174. // }
  2175. // },
  2176. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}",
  2177. // "scopes": [
  2178. // "https://www.googleapis.com/auth/blogger"
  2179. // ]
  2180. // }
  2181. }
  2182. // method id "blogger.comments.get":
  2183. type CommentsGetCall struct {
  2184. s *Service
  2185. blogId string
  2186. postId string
  2187. commentId string
  2188. urlParams_ gensupport.URLParams
  2189. ifNoneMatch_ string
  2190. ctx_ context.Context
  2191. header_ http.Header
  2192. }
  2193. // Get: Gets one comment by ID.
  2194. func (r *CommentsService) Get(blogId string, postId string, commentId string) *CommentsGetCall {
  2195. c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2196. c.blogId = blogId
  2197. c.postId = postId
  2198. c.commentId = commentId
  2199. return c
  2200. }
  2201. // View sets the optional parameter "view": Access level for the
  2202. // requested comment (default: READER). Note that some comments will
  2203. // require elevated permissions, for example comments where the parent
  2204. // posts which is in a draft state, or comments that are pending
  2205. // moderation.
  2206. //
  2207. // Possible values:
  2208. // "ADMIN" - Admin level detail
  2209. // "AUTHOR" - Author level detail
  2210. // "READER" - Admin level detail
  2211. func (c *CommentsGetCall) View(view string) *CommentsGetCall {
  2212. c.urlParams_.Set("view", view)
  2213. return c
  2214. }
  2215. // Fields allows partial responses to be retrieved. See
  2216. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2217. // for more information.
  2218. func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
  2219. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2220. return c
  2221. }
  2222. // IfNoneMatch sets the optional parameter which makes the operation
  2223. // fail if the object's ETag matches the given value. This is useful for
  2224. // getting updates only after the object has changed since the last
  2225. // request. Use googleapi.IsNotModified to check whether the response
  2226. // error from Do is the result of In-None-Match.
  2227. func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
  2228. c.ifNoneMatch_ = entityTag
  2229. return c
  2230. }
  2231. // Context sets the context to be used in this call's Do method. Any
  2232. // pending HTTP request will be aborted if the provided context is
  2233. // canceled.
  2234. func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
  2235. c.ctx_ = ctx
  2236. return c
  2237. }
  2238. // Header returns an http.Header that can be modified by the caller to
  2239. // add HTTP headers to the request.
  2240. func (c *CommentsGetCall) Header() http.Header {
  2241. if c.header_ == nil {
  2242. c.header_ = make(http.Header)
  2243. }
  2244. return c.header_
  2245. }
  2246. func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
  2247. reqHeaders := make(http.Header)
  2248. for k, v := range c.header_ {
  2249. reqHeaders[k] = v
  2250. }
  2251. reqHeaders.Set("User-Agent", c.s.userAgent())
  2252. if c.ifNoneMatch_ != "" {
  2253. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2254. }
  2255. var body io.Reader = nil
  2256. c.urlParams_.Set("alt", alt)
  2257. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}")
  2258. urls += "?" + c.urlParams_.Encode()
  2259. req, _ := http.NewRequest("GET", urls, body)
  2260. req.Header = reqHeaders
  2261. googleapi.Expand(req.URL, map[string]string{
  2262. "blogId": c.blogId,
  2263. "postId": c.postId,
  2264. "commentId": c.commentId,
  2265. })
  2266. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2267. }
  2268. // Do executes the "blogger.comments.get" call.
  2269. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  2270. // code is an error. Response headers are in either
  2271. // *Comment.ServerResponse.Header or (if a response was returned at all)
  2272. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2273. // check whether the returned error was because http.StatusNotModified
  2274. // was returned.
  2275. func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  2276. gensupport.SetOptions(c.urlParams_, opts...)
  2277. res, err := c.doRequest("json")
  2278. if res != nil && res.StatusCode == http.StatusNotModified {
  2279. if res.Body != nil {
  2280. res.Body.Close()
  2281. }
  2282. return nil, &googleapi.Error{
  2283. Code: res.StatusCode,
  2284. Header: res.Header,
  2285. }
  2286. }
  2287. if err != nil {
  2288. return nil, err
  2289. }
  2290. defer googleapi.CloseBody(res)
  2291. if err := googleapi.CheckResponse(res); err != nil {
  2292. return nil, err
  2293. }
  2294. ret := &Comment{
  2295. ServerResponse: googleapi.ServerResponse{
  2296. Header: res.Header,
  2297. HTTPStatusCode: res.StatusCode,
  2298. },
  2299. }
  2300. target := &ret
  2301. if err := gensupport.DecodeResponse(target, res); err != nil {
  2302. return nil, err
  2303. }
  2304. return ret, nil
  2305. // {
  2306. // "description": "Gets one comment by ID.",
  2307. // "httpMethod": "GET",
  2308. // "id": "blogger.comments.get",
  2309. // "parameterOrder": [
  2310. // "blogId",
  2311. // "postId",
  2312. // "commentId"
  2313. // ],
  2314. // "parameters": {
  2315. // "blogId": {
  2316. // "description": "ID of the blog to containing the comment.",
  2317. // "location": "path",
  2318. // "required": true,
  2319. // "type": "string"
  2320. // },
  2321. // "commentId": {
  2322. // "description": "The ID of the comment to get.",
  2323. // "location": "path",
  2324. // "required": true,
  2325. // "type": "string"
  2326. // },
  2327. // "postId": {
  2328. // "description": "ID of the post to fetch posts from.",
  2329. // "location": "path",
  2330. // "required": true,
  2331. // "type": "string"
  2332. // },
  2333. // "view": {
  2334. // "description": "Access level for the requested comment (default: READER). Note that some comments will require elevated permissions, for example comments where the parent posts which is in a draft state, or comments that are pending moderation.",
  2335. // "enum": [
  2336. // "ADMIN",
  2337. // "AUTHOR",
  2338. // "READER"
  2339. // ],
  2340. // "enumDescriptions": [
  2341. // "Admin level detail",
  2342. // "Author level detail",
  2343. // "Admin level detail"
  2344. // ],
  2345. // "location": "query",
  2346. // "type": "string"
  2347. // }
  2348. // },
  2349. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}",
  2350. // "response": {
  2351. // "$ref": "Comment"
  2352. // },
  2353. // "scopes": [
  2354. // "https://www.googleapis.com/auth/blogger",
  2355. // "https://www.googleapis.com/auth/blogger.readonly"
  2356. // ]
  2357. // }
  2358. }
  2359. // method id "blogger.comments.list":
  2360. type CommentsListCall struct {
  2361. s *Service
  2362. blogId string
  2363. postId string
  2364. urlParams_ gensupport.URLParams
  2365. ifNoneMatch_ string
  2366. ctx_ context.Context
  2367. header_ http.Header
  2368. }
  2369. // List: Retrieves the comments for a post, possibly filtered.
  2370. func (r *CommentsService) List(blogId string, postId string) *CommentsListCall {
  2371. c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2372. c.blogId = blogId
  2373. c.postId = postId
  2374. return c
  2375. }
  2376. // EndDate sets the optional parameter "endDate": Latest date of comment
  2377. // to fetch, a date-time with RFC 3339 formatting.
  2378. func (c *CommentsListCall) EndDate(endDate string) *CommentsListCall {
  2379. c.urlParams_.Set("endDate", endDate)
  2380. return c
  2381. }
  2382. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  2383. // body content of the comments is included.
  2384. func (c *CommentsListCall) FetchBodies(fetchBodies bool) *CommentsListCall {
  2385. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  2386. return c
  2387. }
  2388. // MaxResults sets the optional parameter "maxResults": Maximum number
  2389. // of comments to include in the result.
  2390. func (c *CommentsListCall) MaxResults(maxResults int64) *CommentsListCall {
  2391. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2392. return c
  2393. }
  2394. // PageToken sets the optional parameter "pageToken": Continuation token
  2395. // if request is paged.
  2396. func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
  2397. c.urlParams_.Set("pageToken", pageToken)
  2398. return c
  2399. }
  2400. // StartDate sets the optional parameter "startDate": Earliest date of
  2401. // comment to fetch, a date-time with RFC 3339 formatting.
  2402. func (c *CommentsListCall) StartDate(startDate string) *CommentsListCall {
  2403. c.urlParams_.Set("startDate", startDate)
  2404. return c
  2405. }
  2406. // Status sets the optional parameter "status":
  2407. //
  2408. // Possible values:
  2409. // "emptied" - Comments that have had their content removed
  2410. // "live" - Comments that are publicly visible
  2411. // "pending" - Comments that are awaiting administrator approval
  2412. // "spam" - Comments marked as spam by the administrator
  2413. func (c *CommentsListCall) Status(status ...string) *CommentsListCall {
  2414. c.urlParams_.SetMulti("status", append([]string{}, status...))
  2415. return c
  2416. }
  2417. // View sets the optional parameter "view": Access level with which to
  2418. // view the returned result. Note that some fields require elevated
  2419. // access.
  2420. //
  2421. // Possible values:
  2422. // "ADMIN" - Admin level detail
  2423. // "AUTHOR" - Author level detail
  2424. // "READER" - Reader level detail
  2425. func (c *CommentsListCall) View(view string) *CommentsListCall {
  2426. c.urlParams_.Set("view", view)
  2427. return c
  2428. }
  2429. // Fields allows partial responses to be retrieved. See
  2430. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2431. // for more information.
  2432. func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
  2433. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2434. return c
  2435. }
  2436. // IfNoneMatch sets the optional parameter which makes the operation
  2437. // fail if the object's ETag matches the given value. This is useful for
  2438. // getting updates only after the object has changed since the last
  2439. // request. Use googleapi.IsNotModified to check whether the response
  2440. // error from Do is the result of In-None-Match.
  2441. func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
  2442. c.ifNoneMatch_ = entityTag
  2443. return c
  2444. }
  2445. // Context sets the context to be used in this call's Do method. Any
  2446. // pending HTTP request will be aborted if the provided context is
  2447. // canceled.
  2448. func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
  2449. c.ctx_ = ctx
  2450. return c
  2451. }
  2452. // Header returns an http.Header that can be modified by the caller to
  2453. // add HTTP headers to the request.
  2454. func (c *CommentsListCall) Header() http.Header {
  2455. if c.header_ == nil {
  2456. c.header_ = make(http.Header)
  2457. }
  2458. return c.header_
  2459. }
  2460. func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
  2461. reqHeaders := make(http.Header)
  2462. for k, v := range c.header_ {
  2463. reqHeaders[k] = v
  2464. }
  2465. reqHeaders.Set("User-Agent", c.s.userAgent())
  2466. if c.ifNoneMatch_ != "" {
  2467. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2468. }
  2469. var body io.Reader = nil
  2470. c.urlParams_.Set("alt", alt)
  2471. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments")
  2472. urls += "?" + c.urlParams_.Encode()
  2473. req, _ := http.NewRequest("GET", urls, body)
  2474. req.Header = reqHeaders
  2475. googleapi.Expand(req.URL, map[string]string{
  2476. "blogId": c.blogId,
  2477. "postId": c.postId,
  2478. })
  2479. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2480. }
  2481. // Do executes the "blogger.comments.list" call.
  2482. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  2483. // status code is an error. Response headers are in either
  2484. // *CommentList.ServerResponse.Header or (if a response was returned at
  2485. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2486. // to check whether the returned error was because
  2487. // http.StatusNotModified was returned.
  2488. func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  2489. gensupport.SetOptions(c.urlParams_, opts...)
  2490. res, err := c.doRequest("json")
  2491. if res != nil && res.StatusCode == http.StatusNotModified {
  2492. if res.Body != nil {
  2493. res.Body.Close()
  2494. }
  2495. return nil, &googleapi.Error{
  2496. Code: res.StatusCode,
  2497. Header: res.Header,
  2498. }
  2499. }
  2500. if err != nil {
  2501. return nil, err
  2502. }
  2503. defer googleapi.CloseBody(res)
  2504. if err := googleapi.CheckResponse(res); err != nil {
  2505. return nil, err
  2506. }
  2507. ret := &CommentList{
  2508. ServerResponse: googleapi.ServerResponse{
  2509. Header: res.Header,
  2510. HTTPStatusCode: res.StatusCode,
  2511. },
  2512. }
  2513. target := &ret
  2514. if err := gensupport.DecodeResponse(target, res); err != nil {
  2515. return nil, err
  2516. }
  2517. return ret, nil
  2518. // {
  2519. // "description": "Retrieves the comments for a post, possibly filtered.",
  2520. // "httpMethod": "GET",
  2521. // "id": "blogger.comments.list",
  2522. // "parameterOrder": [
  2523. // "blogId",
  2524. // "postId"
  2525. // ],
  2526. // "parameters": {
  2527. // "blogId": {
  2528. // "description": "ID of the blog to fetch comments from.",
  2529. // "location": "path",
  2530. // "required": true,
  2531. // "type": "string"
  2532. // },
  2533. // "endDate": {
  2534. // "description": "Latest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2535. // "format": "date-time",
  2536. // "location": "query",
  2537. // "type": "string"
  2538. // },
  2539. // "fetchBodies": {
  2540. // "description": "Whether the body content of the comments is included.",
  2541. // "location": "query",
  2542. // "type": "boolean"
  2543. // },
  2544. // "maxResults": {
  2545. // "description": "Maximum number of comments to include in the result.",
  2546. // "format": "uint32",
  2547. // "location": "query",
  2548. // "type": "integer"
  2549. // },
  2550. // "pageToken": {
  2551. // "description": "Continuation token if request is paged.",
  2552. // "location": "query",
  2553. // "type": "string"
  2554. // },
  2555. // "postId": {
  2556. // "description": "ID of the post to fetch posts from.",
  2557. // "location": "path",
  2558. // "required": true,
  2559. // "type": "string"
  2560. // },
  2561. // "startDate": {
  2562. // "description": "Earliest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2563. // "format": "date-time",
  2564. // "location": "query",
  2565. // "type": "string"
  2566. // },
  2567. // "status": {
  2568. // "enum": [
  2569. // "emptied",
  2570. // "live",
  2571. // "pending",
  2572. // "spam"
  2573. // ],
  2574. // "enumDescriptions": [
  2575. // "Comments that have had their content removed",
  2576. // "Comments that are publicly visible",
  2577. // "Comments that are awaiting administrator approval",
  2578. // "Comments marked as spam by the administrator"
  2579. // ],
  2580. // "location": "query",
  2581. // "repeated": true,
  2582. // "type": "string"
  2583. // },
  2584. // "view": {
  2585. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  2586. // "enum": [
  2587. // "ADMIN",
  2588. // "AUTHOR",
  2589. // "READER"
  2590. // ],
  2591. // "enumDescriptions": [
  2592. // "Admin level detail",
  2593. // "Author level detail",
  2594. // "Reader level detail"
  2595. // ],
  2596. // "location": "query",
  2597. // "type": "string"
  2598. // }
  2599. // },
  2600. // "path": "blogs/{blogId}/posts/{postId}/comments",
  2601. // "response": {
  2602. // "$ref": "CommentList"
  2603. // },
  2604. // "scopes": [
  2605. // "https://www.googleapis.com/auth/blogger",
  2606. // "https://www.googleapis.com/auth/blogger.readonly"
  2607. // ]
  2608. // }
  2609. }
  2610. // Pages invokes f for each page of results.
  2611. // A non-nil error returned from f will halt the iteration.
  2612. // The provided context supersedes any context provided to the Context method.
  2613. func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  2614. c.ctx_ = ctx
  2615. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2616. for {
  2617. x, err := c.Do()
  2618. if err != nil {
  2619. return err
  2620. }
  2621. if err := f(x); err != nil {
  2622. return err
  2623. }
  2624. if x.NextPageToken == "" {
  2625. return nil
  2626. }
  2627. c.PageToken(x.NextPageToken)
  2628. }
  2629. }
  2630. // method id "blogger.comments.listByBlog":
  2631. type CommentsListByBlogCall struct {
  2632. s *Service
  2633. blogId string
  2634. urlParams_ gensupport.URLParams
  2635. ifNoneMatch_ string
  2636. ctx_ context.Context
  2637. header_ http.Header
  2638. }
  2639. // ListByBlog: Retrieves the comments for a blog, across all posts,
  2640. // possibly filtered.
  2641. func (r *CommentsService) ListByBlog(blogId string) *CommentsListByBlogCall {
  2642. c := &CommentsListByBlogCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2643. c.blogId = blogId
  2644. return c
  2645. }
  2646. // EndDate sets the optional parameter "endDate": Latest date of comment
  2647. // to fetch, a date-time with RFC 3339 formatting.
  2648. func (c *CommentsListByBlogCall) EndDate(endDate string) *CommentsListByBlogCall {
  2649. c.urlParams_.Set("endDate", endDate)
  2650. return c
  2651. }
  2652. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  2653. // body content of the comments is included.
  2654. func (c *CommentsListByBlogCall) FetchBodies(fetchBodies bool) *CommentsListByBlogCall {
  2655. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  2656. return c
  2657. }
  2658. // MaxResults sets the optional parameter "maxResults": Maximum number
  2659. // of comments to include in the result.
  2660. func (c *CommentsListByBlogCall) MaxResults(maxResults int64) *CommentsListByBlogCall {
  2661. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2662. return c
  2663. }
  2664. // PageToken sets the optional parameter "pageToken": Continuation token
  2665. // if request is paged.
  2666. func (c *CommentsListByBlogCall) PageToken(pageToken string) *CommentsListByBlogCall {
  2667. c.urlParams_.Set("pageToken", pageToken)
  2668. return c
  2669. }
  2670. // StartDate sets the optional parameter "startDate": Earliest date of
  2671. // comment to fetch, a date-time with RFC 3339 formatting.
  2672. func (c *CommentsListByBlogCall) StartDate(startDate string) *CommentsListByBlogCall {
  2673. c.urlParams_.Set("startDate", startDate)
  2674. return c
  2675. }
  2676. // Status sets the optional parameter "status":
  2677. //
  2678. // Possible values:
  2679. // "emptied" - Comments that have had their content removed
  2680. // "live" - Comments that are publicly visible
  2681. // "pending" - Comments that are awaiting administrator approval
  2682. // "spam" - Comments marked as spam by the administrator
  2683. func (c *CommentsListByBlogCall) Status(status ...string) *CommentsListByBlogCall {
  2684. c.urlParams_.SetMulti("status", append([]string{}, status...))
  2685. return c
  2686. }
  2687. // Fields allows partial responses to be retrieved. See
  2688. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2689. // for more information.
  2690. func (c *CommentsListByBlogCall) Fields(s ...googleapi.Field) *CommentsListByBlogCall {
  2691. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2692. return c
  2693. }
  2694. // IfNoneMatch sets the optional parameter which makes the operation
  2695. // fail if the object's ETag matches the given value. This is useful for
  2696. // getting updates only after the object has changed since the last
  2697. // request. Use googleapi.IsNotModified to check whether the response
  2698. // error from Do is the result of In-None-Match.
  2699. func (c *CommentsListByBlogCall) IfNoneMatch(entityTag string) *CommentsListByBlogCall {
  2700. c.ifNoneMatch_ = entityTag
  2701. return c
  2702. }
  2703. // Context sets the context to be used in this call's Do method. Any
  2704. // pending HTTP request will be aborted if the provided context is
  2705. // canceled.
  2706. func (c *CommentsListByBlogCall) Context(ctx context.Context) *CommentsListByBlogCall {
  2707. c.ctx_ = ctx
  2708. return c
  2709. }
  2710. // Header returns an http.Header that can be modified by the caller to
  2711. // add HTTP headers to the request.
  2712. func (c *CommentsListByBlogCall) Header() http.Header {
  2713. if c.header_ == nil {
  2714. c.header_ = make(http.Header)
  2715. }
  2716. return c.header_
  2717. }
  2718. func (c *CommentsListByBlogCall) doRequest(alt string) (*http.Response, error) {
  2719. reqHeaders := make(http.Header)
  2720. for k, v := range c.header_ {
  2721. reqHeaders[k] = v
  2722. }
  2723. reqHeaders.Set("User-Agent", c.s.userAgent())
  2724. if c.ifNoneMatch_ != "" {
  2725. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2726. }
  2727. var body io.Reader = nil
  2728. c.urlParams_.Set("alt", alt)
  2729. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/comments")
  2730. urls += "?" + c.urlParams_.Encode()
  2731. req, _ := http.NewRequest("GET", urls, body)
  2732. req.Header = reqHeaders
  2733. googleapi.Expand(req.URL, map[string]string{
  2734. "blogId": c.blogId,
  2735. })
  2736. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2737. }
  2738. // Do executes the "blogger.comments.listByBlog" call.
  2739. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  2740. // status code is an error. Response headers are in either
  2741. // *CommentList.ServerResponse.Header or (if a response was returned at
  2742. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2743. // to check whether the returned error was because
  2744. // http.StatusNotModified was returned.
  2745. func (c *CommentsListByBlogCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  2746. gensupport.SetOptions(c.urlParams_, opts...)
  2747. res, err := c.doRequest("json")
  2748. if res != nil && res.StatusCode == http.StatusNotModified {
  2749. if res.Body != nil {
  2750. res.Body.Close()
  2751. }
  2752. return nil, &googleapi.Error{
  2753. Code: res.StatusCode,
  2754. Header: res.Header,
  2755. }
  2756. }
  2757. if err != nil {
  2758. return nil, err
  2759. }
  2760. defer googleapi.CloseBody(res)
  2761. if err := googleapi.CheckResponse(res); err != nil {
  2762. return nil, err
  2763. }
  2764. ret := &CommentList{
  2765. ServerResponse: googleapi.ServerResponse{
  2766. Header: res.Header,
  2767. HTTPStatusCode: res.StatusCode,
  2768. },
  2769. }
  2770. target := &ret
  2771. if err := gensupport.DecodeResponse(target, res); err != nil {
  2772. return nil, err
  2773. }
  2774. return ret, nil
  2775. // {
  2776. // "description": "Retrieves the comments for a blog, across all posts, possibly filtered.",
  2777. // "httpMethod": "GET",
  2778. // "id": "blogger.comments.listByBlog",
  2779. // "parameterOrder": [
  2780. // "blogId"
  2781. // ],
  2782. // "parameters": {
  2783. // "blogId": {
  2784. // "description": "ID of the blog to fetch comments from.",
  2785. // "location": "path",
  2786. // "required": true,
  2787. // "type": "string"
  2788. // },
  2789. // "endDate": {
  2790. // "description": "Latest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2791. // "format": "date-time",
  2792. // "location": "query",
  2793. // "type": "string"
  2794. // },
  2795. // "fetchBodies": {
  2796. // "description": "Whether the body content of the comments is included.",
  2797. // "location": "query",
  2798. // "type": "boolean"
  2799. // },
  2800. // "maxResults": {
  2801. // "description": "Maximum number of comments to include in the result.",
  2802. // "format": "uint32",
  2803. // "location": "query",
  2804. // "type": "integer"
  2805. // },
  2806. // "pageToken": {
  2807. // "description": "Continuation token if request is paged.",
  2808. // "location": "query",
  2809. // "type": "string"
  2810. // },
  2811. // "startDate": {
  2812. // "description": "Earliest date of comment to fetch, a date-time with RFC 3339 formatting.",
  2813. // "format": "date-time",
  2814. // "location": "query",
  2815. // "type": "string"
  2816. // },
  2817. // "status": {
  2818. // "enum": [
  2819. // "emptied",
  2820. // "live",
  2821. // "pending",
  2822. // "spam"
  2823. // ],
  2824. // "enumDescriptions": [
  2825. // "Comments that have had their content removed",
  2826. // "Comments that are publicly visible",
  2827. // "Comments that are awaiting administrator approval",
  2828. // "Comments marked as spam by the administrator"
  2829. // ],
  2830. // "location": "query",
  2831. // "repeated": true,
  2832. // "type": "string"
  2833. // }
  2834. // },
  2835. // "path": "blogs/{blogId}/comments",
  2836. // "response": {
  2837. // "$ref": "CommentList"
  2838. // },
  2839. // "scopes": [
  2840. // "https://www.googleapis.com/auth/blogger",
  2841. // "https://www.googleapis.com/auth/blogger.readonly"
  2842. // ]
  2843. // }
  2844. }
  2845. // Pages invokes f for each page of results.
  2846. // A non-nil error returned from f will halt the iteration.
  2847. // The provided context supersedes any context provided to the Context method.
  2848. func (c *CommentsListByBlogCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  2849. c.ctx_ = ctx
  2850. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2851. for {
  2852. x, err := c.Do()
  2853. if err != nil {
  2854. return err
  2855. }
  2856. if err := f(x); err != nil {
  2857. return err
  2858. }
  2859. if x.NextPageToken == "" {
  2860. return nil
  2861. }
  2862. c.PageToken(x.NextPageToken)
  2863. }
  2864. }
  2865. // method id "blogger.comments.markAsSpam":
  2866. type CommentsMarkAsSpamCall struct {
  2867. s *Service
  2868. blogId string
  2869. postId string
  2870. commentId string
  2871. urlParams_ gensupport.URLParams
  2872. ctx_ context.Context
  2873. header_ http.Header
  2874. }
  2875. // MarkAsSpam: Marks a comment as spam.
  2876. func (r *CommentsService) MarkAsSpam(blogId string, postId string, commentId string) *CommentsMarkAsSpamCall {
  2877. c := &CommentsMarkAsSpamCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2878. c.blogId = blogId
  2879. c.postId = postId
  2880. c.commentId = commentId
  2881. return c
  2882. }
  2883. // Fields allows partial responses to be retrieved. See
  2884. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2885. // for more information.
  2886. func (c *CommentsMarkAsSpamCall) Fields(s ...googleapi.Field) *CommentsMarkAsSpamCall {
  2887. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2888. return c
  2889. }
  2890. // Context sets the context to be used in this call's Do method. Any
  2891. // pending HTTP request will be aborted if the provided context is
  2892. // canceled.
  2893. func (c *CommentsMarkAsSpamCall) Context(ctx context.Context) *CommentsMarkAsSpamCall {
  2894. c.ctx_ = ctx
  2895. return c
  2896. }
  2897. // Header returns an http.Header that can be modified by the caller to
  2898. // add HTTP headers to the request.
  2899. func (c *CommentsMarkAsSpamCall) Header() http.Header {
  2900. if c.header_ == nil {
  2901. c.header_ = make(http.Header)
  2902. }
  2903. return c.header_
  2904. }
  2905. func (c *CommentsMarkAsSpamCall) doRequest(alt string) (*http.Response, error) {
  2906. reqHeaders := make(http.Header)
  2907. for k, v := range c.header_ {
  2908. reqHeaders[k] = v
  2909. }
  2910. reqHeaders.Set("User-Agent", c.s.userAgent())
  2911. var body io.Reader = nil
  2912. c.urlParams_.Set("alt", alt)
  2913. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}/spam")
  2914. urls += "?" + c.urlParams_.Encode()
  2915. req, _ := http.NewRequest("POST", urls, body)
  2916. req.Header = reqHeaders
  2917. googleapi.Expand(req.URL, map[string]string{
  2918. "blogId": c.blogId,
  2919. "postId": c.postId,
  2920. "commentId": c.commentId,
  2921. })
  2922. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2923. }
  2924. // Do executes the "blogger.comments.markAsSpam" call.
  2925. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  2926. // code is an error. Response headers are in either
  2927. // *Comment.ServerResponse.Header or (if a response was returned at all)
  2928. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2929. // check whether the returned error was because http.StatusNotModified
  2930. // was returned.
  2931. func (c *CommentsMarkAsSpamCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  2932. gensupport.SetOptions(c.urlParams_, opts...)
  2933. res, err := c.doRequest("json")
  2934. if res != nil && res.StatusCode == http.StatusNotModified {
  2935. if res.Body != nil {
  2936. res.Body.Close()
  2937. }
  2938. return nil, &googleapi.Error{
  2939. Code: res.StatusCode,
  2940. Header: res.Header,
  2941. }
  2942. }
  2943. if err != nil {
  2944. return nil, err
  2945. }
  2946. defer googleapi.CloseBody(res)
  2947. if err := googleapi.CheckResponse(res); err != nil {
  2948. return nil, err
  2949. }
  2950. ret := &Comment{
  2951. ServerResponse: googleapi.ServerResponse{
  2952. Header: res.Header,
  2953. HTTPStatusCode: res.StatusCode,
  2954. },
  2955. }
  2956. target := &ret
  2957. if err := gensupport.DecodeResponse(target, res); err != nil {
  2958. return nil, err
  2959. }
  2960. return ret, nil
  2961. // {
  2962. // "description": "Marks a comment as spam.",
  2963. // "httpMethod": "POST",
  2964. // "id": "blogger.comments.markAsSpam",
  2965. // "parameterOrder": [
  2966. // "blogId",
  2967. // "postId",
  2968. // "commentId"
  2969. // ],
  2970. // "parameters": {
  2971. // "blogId": {
  2972. // "description": "The ID of the Blog.",
  2973. // "location": "path",
  2974. // "required": true,
  2975. // "type": "string"
  2976. // },
  2977. // "commentId": {
  2978. // "description": "The ID of the comment to mark as spam.",
  2979. // "location": "path",
  2980. // "required": true,
  2981. // "type": "string"
  2982. // },
  2983. // "postId": {
  2984. // "description": "The ID of the Post.",
  2985. // "location": "path",
  2986. // "required": true,
  2987. // "type": "string"
  2988. // }
  2989. // },
  2990. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}/spam",
  2991. // "response": {
  2992. // "$ref": "Comment"
  2993. // },
  2994. // "scopes": [
  2995. // "https://www.googleapis.com/auth/blogger"
  2996. // ]
  2997. // }
  2998. }
  2999. // method id "blogger.comments.removeContent":
  3000. type CommentsRemoveContentCall struct {
  3001. s *Service
  3002. blogId string
  3003. postId string
  3004. commentId string
  3005. urlParams_ gensupport.URLParams
  3006. ctx_ context.Context
  3007. header_ http.Header
  3008. }
  3009. // RemoveContent: Removes the content of a comment.
  3010. func (r *CommentsService) RemoveContent(blogId string, postId string, commentId string) *CommentsRemoveContentCall {
  3011. c := &CommentsRemoveContentCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3012. c.blogId = blogId
  3013. c.postId = postId
  3014. c.commentId = commentId
  3015. return c
  3016. }
  3017. // Fields allows partial responses to be retrieved. See
  3018. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3019. // for more information.
  3020. func (c *CommentsRemoveContentCall) Fields(s ...googleapi.Field) *CommentsRemoveContentCall {
  3021. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3022. return c
  3023. }
  3024. // Context sets the context to be used in this call's Do method. Any
  3025. // pending HTTP request will be aborted if the provided context is
  3026. // canceled.
  3027. func (c *CommentsRemoveContentCall) Context(ctx context.Context) *CommentsRemoveContentCall {
  3028. c.ctx_ = ctx
  3029. return c
  3030. }
  3031. // Header returns an http.Header that can be modified by the caller to
  3032. // add HTTP headers to the request.
  3033. func (c *CommentsRemoveContentCall) Header() http.Header {
  3034. if c.header_ == nil {
  3035. c.header_ = make(http.Header)
  3036. }
  3037. return c.header_
  3038. }
  3039. func (c *CommentsRemoveContentCall) doRequest(alt string) (*http.Response, error) {
  3040. reqHeaders := make(http.Header)
  3041. for k, v := range c.header_ {
  3042. reqHeaders[k] = v
  3043. }
  3044. reqHeaders.Set("User-Agent", c.s.userAgent())
  3045. var body io.Reader = nil
  3046. c.urlParams_.Set("alt", alt)
  3047. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/comments/{commentId}/removecontent")
  3048. urls += "?" + c.urlParams_.Encode()
  3049. req, _ := http.NewRequest("POST", urls, body)
  3050. req.Header = reqHeaders
  3051. googleapi.Expand(req.URL, map[string]string{
  3052. "blogId": c.blogId,
  3053. "postId": c.postId,
  3054. "commentId": c.commentId,
  3055. })
  3056. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3057. }
  3058. // Do executes the "blogger.comments.removeContent" call.
  3059. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  3060. // code is an error. Response headers are in either
  3061. // *Comment.ServerResponse.Header or (if a response was returned at all)
  3062. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3063. // check whether the returned error was because http.StatusNotModified
  3064. // was returned.
  3065. func (c *CommentsRemoveContentCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  3066. gensupport.SetOptions(c.urlParams_, opts...)
  3067. res, err := c.doRequest("json")
  3068. if res != nil && res.StatusCode == http.StatusNotModified {
  3069. if res.Body != nil {
  3070. res.Body.Close()
  3071. }
  3072. return nil, &googleapi.Error{
  3073. Code: res.StatusCode,
  3074. Header: res.Header,
  3075. }
  3076. }
  3077. if err != nil {
  3078. return nil, err
  3079. }
  3080. defer googleapi.CloseBody(res)
  3081. if err := googleapi.CheckResponse(res); err != nil {
  3082. return nil, err
  3083. }
  3084. ret := &Comment{
  3085. ServerResponse: googleapi.ServerResponse{
  3086. Header: res.Header,
  3087. HTTPStatusCode: res.StatusCode,
  3088. },
  3089. }
  3090. target := &ret
  3091. if err := gensupport.DecodeResponse(target, res); err != nil {
  3092. return nil, err
  3093. }
  3094. return ret, nil
  3095. // {
  3096. // "description": "Removes the content of a comment.",
  3097. // "httpMethod": "POST",
  3098. // "id": "blogger.comments.removeContent",
  3099. // "parameterOrder": [
  3100. // "blogId",
  3101. // "postId",
  3102. // "commentId"
  3103. // ],
  3104. // "parameters": {
  3105. // "blogId": {
  3106. // "description": "The ID of the Blog.",
  3107. // "location": "path",
  3108. // "required": true,
  3109. // "type": "string"
  3110. // },
  3111. // "commentId": {
  3112. // "description": "The ID of the comment to delete content from.",
  3113. // "location": "path",
  3114. // "required": true,
  3115. // "type": "string"
  3116. // },
  3117. // "postId": {
  3118. // "description": "The ID of the Post.",
  3119. // "location": "path",
  3120. // "required": true,
  3121. // "type": "string"
  3122. // }
  3123. // },
  3124. // "path": "blogs/{blogId}/posts/{postId}/comments/{commentId}/removecontent",
  3125. // "response": {
  3126. // "$ref": "Comment"
  3127. // },
  3128. // "scopes": [
  3129. // "https://www.googleapis.com/auth/blogger"
  3130. // ]
  3131. // }
  3132. }
  3133. // method id "blogger.pageViews.get":
  3134. type PageViewsGetCall struct {
  3135. s *Service
  3136. blogId string
  3137. urlParams_ gensupport.URLParams
  3138. ifNoneMatch_ string
  3139. ctx_ context.Context
  3140. header_ http.Header
  3141. }
  3142. // Get: Retrieve pageview stats for a Blog.
  3143. func (r *PageViewsService) Get(blogId string) *PageViewsGetCall {
  3144. c := &PageViewsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3145. c.blogId = blogId
  3146. return c
  3147. }
  3148. // Range sets the optional parameter "range":
  3149. //
  3150. // Possible values:
  3151. // "30DAYS" - Page view counts from the last thirty days.
  3152. // "7DAYS" - Page view counts from the last seven days.
  3153. // "all" - Total page view counts from all time.
  3154. func (c *PageViewsGetCall) Range(range_ ...string) *PageViewsGetCall {
  3155. c.urlParams_.SetMulti("range", append([]string{}, range_...))
  3156. return c
  3157. }
  3158. // Fields allows partial responses to be retrieved. See
  3159. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3160. // for more information.
  3161. func (c *PageViewsGetCall) Fields(s ...googleapi.Field) *PageViewsGetCall {
  3162. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3163. return c
  3164. }
  3165. // IfNoneMatch sets the optional parameter which makes the operation
  3166. // fail if the object's ETag matches the given value. This is useful for
  3167. // getting updates only after the object has changed since the last
  3168. // request. Use googleapi.IsNotModified to check whether the response
  3169. // error from Do is the result of In-None-Match.
  3170. func (c *PageViewsGetCall) IfNoneMatch(entityTag string) *PageViewsGetCall {
  3171. c.ifNoneMatch_ = entityTag
  3172. return c
  3173. }
  3174. // Context sets the context to be used in this call's Do method. Any
  3175. // pending HTTP request will be aborted if the provided context is
  3176. // canceled.
  3177. func (c *PageViewsGetCall) Context(ctx context.Context) *PageViewsGetCall {
  3178. c.ctx_ = ctx
  3179. return c
  3180. }
  3181. // Header returns an http.Header that can be modified by the caller to
  3182. // add HTTP headers to the request.
  3183. func (c *PageViewsGetCall) Header() http.Header {
  3184. if c.header_ == nil {
  3185. c.header_ = make(http.Header)
  3186. }
  3187. return c.header_
  3188. }
  3189. func (c *PageViewsGetCall) doRequest(alt string) (*http.Response, error) {
  3190. reqHeaders := make(http.Header)
  3191. for k, v := range c.header_ {
  3192. reqHeaders[k] = v
  3193. }
  3194. reqHeaders.Set("User-Agent", c.s.userAgent())
  3195. if c.ifNoneMatch_ != "" {
  3196. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3197. }
  3198. var body io.Reader = nil
  3199. c.urlParams_.Set("alt", alt)
  3200. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pageviews")
  3201. urls += "?" + c.urlParams_.Encode()
  3202. req, _ := http.NewRequest("GET", urls, body)
  3203. req.Header = reqHeaders
  3204. googleapi.Expand(req.URL, map[string]string{
  3205. "blogId": c.blogId,
  3206. })
  3207. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3208. }
  3209. // Do executes the "blogger.pageViews.get" call.
  3210. // Exactly one of *Pageviews or error will be non-nil. Any non-2xx
  3211. // status code is an error. Response headers are in either
  3212. // *Pageviews.ServerResponse.Header or (if a response was returned at
  3213. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3214. // to check whether the returned error was because
  3215. // http.StatusNotModified was returned.
  3216. func (c *PageViewsGetCall) Do(opts ...googleapi.CallOption) (*Pageviews, error) {
  3217. gensupport.SetOptions(c.urlParams_, opts...)
  3218. res, err := c.doRequest("json")
  3219. if res != nil && res.StatusCode == http.StatusNotModified {
  3220. if res.Body != nil {
  3221. res.Body.Close()
  3222. }
  3223. return nil, &googleapi.Error{
  3224. Code: res.StatusCode,
  3225. Header: res.Header,
  3226. }
  3227. }
  3228. if err != nil {
  3229. return nil, err
  3230. }
  3231. defer googleapi.CloseBody(res)
  3232. if err := googleapi.CheckResponse(res); err != nil {
  3233. return nil, err
  3234. }
  3235. ret := &Pageviews{
  3236. ServerResponse: googleapi.ServerResponse{
  3237. Header: res.Header,
  3238. HTTPStatusCode: res.StatusCode,
  3239. },
  3240. }
  3241. target := &ret
  3242. if err := gensupport.DecodeResponse(target, res); err != nil {
  3243. return nil, err
  3244. }
  3245. return ret, nil
  3246. // {
  3247. // "description": "Retrieve pageview stats for a Blog.",
  3248. // "httpMethod": "GET",
  3249. // "id": "blogger.pageViews.get",
  3250. // "parameterOrder": [
  3251. // "blogId"
  3252. // ],
  3253. // "parameters": {
  3254. // "blogId": {
  3255. // "description": "The ID of the blog to get.",
  3256. // "location": "path",
  3257. // "required": true,
  3258. // "type": "string"
  3259. // },
  3260. // "range": {
  3261. // "enum": [
  3262. // "30DAYS",
  3263. // "7DAYS",
  3264. // "all"
  3265. // ],
  3266. // "enumDescriptions": [
  3267. // "Page view counts from the last thirty days.",
  3268. // "Page view counts from the last seven days.",
  3269. // "Total page view counts from all time."
  3270. // ],
  3271. // "location": "query",
  3272. // "repeated": true,
  3273. // "type": "string"
  3274. // }
  3275. // },
  3276. // "path": "blogs/{blogId}/pageviews",
  3277. // "response": {
  3278. // "$ref": "Pageviews"
  3279. // },
  3280. // "scopes": [
  3281. // "https://www.googleapis.com/auth/blogger"
  3282. // ]
  3283. // }
  3284. }
  3285. // method id "blogger.pages.delete":
  3286. type PagesDeleteCall struct {
  3287. s *Service
  3288. blogId string
  3289. pageId string
  3290. urlParams_ gensupport.URLParams
  3291. ctx_ context.Context
  3292. header_ http.Header
  3293. }
  3294. // Delete: Delete a page by ID.
  3295. func (r *PagesService) Delete(blogId string, pageId string) *PagesDeleteCall {
  3296. c := &PagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3297. c.blogId = blogId
  3298. c.pageId = pageId
  3299. return c
  3300. }
  3301. // Fields allows partial responses to be retrieved. See
  3302. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3303. // for more information.
  3304. func (c *PagesDeleteCall) Fields(s ...googleapi.Field) *PagesDeleteCall {
  3305. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3306. return c
  3307. }
  3308. // Context sets the context to be used in this call's Do method. Any
  3309. // pending HTTP request will be aborted if the provided context is
  3310. // canceled.
  3311. func (c *PagesDeleteCall) Context(ctx context.Context) *PagesDeleteCall {
  3312. c.ctx_ = ctx
  3313. return c
  3314. }
  3315. // Header returns an http.Header that can be modified by the caller to
  3316. // add HTTP headers to the request.
  3317. func (c *PagesDeleteCall) Header() http.Header {
  3318. if c.header_ == nil {
  3319. c.header_ = make(http.Header)
  3320. }
  3321. return c.header_
  3322. }
  3323. func (c *PagesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3324. reqHeaders := make(http.Header)
  3325. for k, v := range c.header_ {
  3326. reqHeaders[k] = v
  3327. }
  3328. reqHeaders.Set("User-Agent", c.s.userAgent())
  3329. var body io.Reader = nil
  3330. c.urlParams_.Set("alt", alt)
  3331. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  3332. urls += "?" + c.urlParams_.Encode()
  3333. req, _ := http.NewRequest("DELETE", urls, body)
  3334. req.Header = reqHeaders
  3335. googleapi.Expand(req.URL, map[string]string{
  3336. "blogId": c.blogId,
  3337. "pageId": c.pageId,
  3338. })
  3339. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3340. }
  3341. // Do executes the "blogger.pages.delete" call.
  3342. func (c *PagesDeleteCall) Do(opts ...googleapi.CallOption) error {
  3343. gensupport.SetOptions(c.urlParams_, opts...)
  3344. res, err := c.doRequest("json")
  3345. if err != nil {
  3346. return err
  3347. }
  3348. defer googleapi.CloseBody(res)
  3349. if err := googleapi.CheckResponse(res); err != nil {
  3350. return err
  3351. }
  3352. return nil
  3353. // {
  3354. // "description": "Delete a page by ID.",
  3355. // "httpMethod": "DELETE",
  3356. // "id": "blogger.pages.delete",
  3357. // "parameterOrder": [
  3358. // "blogId",
  3359. // "pageId"
  3360. // ],
  3361. // "parameters": {
  3362. // "blogId": {
  3363. // "description": "The ID of the Blog.",
  3364. // "location": "path",
  3365. // "required": true,
  3366. // "type": "string"
  3367. // },
  3368. // "pageId": {
  3369. // "description": "The ID of the Page.",
  3370. // "location": "path",
  3371. // "required": true,
  3372. // "type": "string"
  3373. // }
  3374. // },
  3375. // "path": "blogs/{blogId}/pages/{pageId}",
  3376. // "scopes": [
  3377. // "https://www.googleapis.com/auth/blogger"
  3378. // ]
  3379. // }
  3380. }
  3381. // method id "blogger.pages.get":
  3382. type PagesGetCall struct {
  3383. s *Service
  3384. blogId string
  3385. pageId string
  3386. urlParams_ gensupport.URLParams
  3387. ifNoneMatch_ string
  3388. ctx_ context.Context
  3389. header_ http.Header
  3390. }
  3391. // Get: Gets one blog page by ID.
  3392. func (r *PagesService) Get(blogId string, pageId string) *PagesGetCall {
  3393. c := &PagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3394. c.blogId = blogId
  3395. c.pageId = pageId
  3396. return c
  3397. }
  3398. // View sets the optional parameter "view":
  3399. //
  3400. // Possible values:
  3401. // "ADMIN" - Admin level detail
  3402. // "AUTHOR" - Author level detail
  3403. // "READER" - Reader level detail
  3404. func (c *PagesGetCall) View(view string) *PagesGetCall {
  3405. c.urlParams_.Set("view", view)
  3406. return c
  3407. }
  3408. // Fields allows partial responses to be retrieved. See
  3409. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3410. // for more information.
  3411. func (c *PagesGetCall) Fields(s ...googleapi.Field) *PagesGetCall {
  3412. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3413. return c
  3414. }
  3415. // IfNoneMatch sets the optional parameter which makes the operation
  3416. // fail if the object's ETag matches the given value. This is useful for
  3417. // getting updates only after the object has changed since the last
  3418. // request. Use googleapi.IsNotModified to check whether the response
  3419. // error from Do is the result of In-None-Match.
  3420. func (c *PagesGetCall) IfNoneMatch(entityTag string) *PagesGetCall {
  3421. c.ifNoneMatch_ = entityTag
  3422. return c
  3423. }
  3424. // Context sets the context to be used in this call's Do method. Any
  3425. // pending HTTP request will be aborted if the provided context is
  3426. // canceled.
  3427. func (c *PagesGetCall) Context(ctx context.Context) *PagesGetCall {
  3428. c.ctx_ = ctx
  3429. return c
  3430. }
  3431. // Header returns an http.Header that can be modified by the caller to
  3432. // add HTTP headers to the request.
  3433. func (c *PagesGetCall) Header() http.Header {
  3434. if c.header_ == nil {
  3435. c.header_ = make(http.Header)
  3436. }
  3437. return c.header_
  3438. }
  3439. func (c *PagesGetCall) doRequest(alt string) (*http.Response, error) {
  3440. reqHeaders := make(http.Header)
  3441. for k, v := range c.header_ {
  3442. reqHeaders[k] = v
  3443. }
  3444. reqHeaders.Set("User-Agent", c.s.userAgent())
  3445. if c.ifNoneMatch_ != "" {
  3446. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3447. }
  3448. var body io.Reader = nil
  3449. c.urlParams_.Set("alt", alt)
  3450. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  3451. urls += "?" + c.urlParams_.Encode()
  3452. req, _ := http.NewRequest("GET", urls, body)
  3453. req.Header = reqHeaders
  3454. googleapi.Expand(req.URL, map[string]string{
  3455. "blogId": c.blogId,
  3456. "pageId": c.pageId,
  3457. })
  3458. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3459. }
  3460. // Do executes the "blogger.pages.get" call.
  3461. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3462. // code is an error. Response headers are in either
  3463. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3464. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3465. // whether the returned error was because http.StatusNotModified was
  3466. // returned.
  3467. func (c *PagesGetCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3468. gensupport.SetOptions(c.urlParams_, opts...)
  3469. res, err := c.doRequest("json")
  3470. if res != nil && res.StatusCode == http.StatusNotModified {
  3471. if res.Body != nil {
  3472. res.Body.Close()
  3473. }
  3474. return nil, &googleapi.Error{
  3475. Code: res.StatusCode,
  3476. Header: res.Header,
  3477. }
  3478. }
  3479. if err != nil {
  3480. return nil, err
  3481. }
  3482. defer googleapi.CloseBody(res)
  3483. if err := googleapi.CheckResponse(res); err != nil {
  3484. return nil, err
  3485. }
  3486. ret := &Page{
  3487. ServerResponse: googleapi.ServerResponse{
  3488. Header: res.Header,
  3489. HTTPStatusCode: res.StatusCode,
  3490. },
  3491. }
  3492. target := &ret
  3493. if err := gensupport.DecodeResponse(target, res); err != nil {
  3494. return nil, err
  3495. }
  3496. return ret, nil
  3497. // {
  3498. // "description": "Gets one blog page by ID.",
  3499. // "httpMethod": "GET",
  3500. // "id": "blogger.pages.get",
  3501. // "parameterOrder": [
  3502. // "blogId",
  3503. // "pageId"
  3504. // ],
  3505. // "parameters": {
  3506. // "blogId": {
  3507. // "description": "ID of the blog containing the page.",
  3508. // "location": "path",
  3509. // "required": true,
  3510. // "type": "string"
  3511. // },
  3512. // "pageId": {
  3513. // "description": "The ID of the page to get.",
  3514. // "location": "path",
  3515. // "required": true,
  3516. // "type": "string"
  3517. // },
  3518. // "view": {
  3519. // "enum": [
  3520. // "ADMIN",
  3521. // "AUTHOR",
  3522. // "READER"
  3523. // ],
  3524. // "enumDescriptions": [
  3525. // "Admin level detail",
  3526. // "Author level detail",
  3527. // "Reader level detail"
  3528. // ],
  3529. // "location": "query",
  3530. // "type": "string"
  3531. // }
  3532. // },
  3533. // "path": "blogs/{blogId}/pages/{pageId}",
  3534. // "response": {
  3535. // "$ref": "Page"
  3536. // },
  3537. // "scopes": [
  3538. // "https://www.googleapis.com/auth/blogger",
  3539. // "https://www.googleapis.com/auth/blogger.readonly"
  3540. // ]
  3541. // }
  3542. }
  3543. // method id "blogger.pages.insert":
  3544. type PagesInsertCall struct {
  3545. s *Service
  3546. blogId string
  3547. page *Page
  3548. urlParams_ gensupport.URLParams
  3549. ctx_ context.Context
  3550. header_ http.Header
  3551. }
  3552. // Insert: Add a page.
  3553. func (r *PagesService) Insert(blogId string, page *Page) *PagesInsertCall {
  3554. c := &PagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3555. c.blogId = blogId
  3556. c.page = page
  3557. return c
  3558. }
  3559. // IsDraft sets the optional parameter "isDraft": Whether to create the
  3560. // page as a draft (default: false).
  3561. func (c *PagesInsertCall) IsDraft(isDraft bool) *PagesInsertCall {
  3562. c.urlParams_.Set("isDraft", fmt.Sprint(isDraft))
  3563. return c
  3564. }
  3565. // Fields allows partial responses to be retrieved. See
  3566. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3567. // for more information.
  3568. func (c *PagesInsertCall) Fields(s ...googleapi.Field) *PagesInsertCall {
  3569. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3570. return c
  3571. }
  3572. // Context sets the context to be used in this call's Do method. Any
  3573. // pending HTTP request will be aborted if the provided context is
  3574. // canceled.
  3575. func (c *PagesInsertCall) Context(ctx context.Context) *PagesInsertCall {
  3576. c.ctx_ = ctx
  3577. return c
  3578. }
  3579. // Header returns an http.Header that can be modified by the caller to
  3580. // add HTTP headers to the request.
  3581. func (c *PagesInsertCall) Header() http.Header {
  3582. if c.header_ == nil {
  3583. c.header_ = make(http.Header)
  3584. }
  3585. return c.header_
  3586. }
  3587. func (c *PagesInsertCall) doRequest(alt string) (*http.Response, error) {
  3588. reqHeaders := make(http.Header)
  3589. for k, v := range c.header_ {
  3590. reqHeaders[k] = v
  3591. }
  3592. reqHeaders.Set("User-Agent", c.s.userAgent())
  3593. var body io.Reader = nil
  3594. body, err := googleapi.WithoutDataWrapper.JSONReader(c.page)
  3595. if err != nil {
  3596. return nil, err
  3597. }
  3598. reqHeaders.Set("Content-Type", "application/json")
  3599. c.urlParams_.Set("alt", alt)
  3600. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages")
  3601. urls += "?" + c.urlParams_.Encode()
  3602. req, _ := http.NewRequest("POST", urls, body)
  3603. req.Header = reqHeaders
  3604. googleapi.Expand(req.URL, map[string]string{
  3605. "blogId": c.blogId,
  3606. })
  3607. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3608. }
  3609. // Do executes the "blogger.pages.insert" call.
  3610. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3611. // code is an error. Response headers are in either
  3612. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3613. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3614. // whether the returned error was because http.StatusNotModified was
  3615. // returned.
  3616. func (c *PagesInsertCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3617. gensupport.SetOptions(c.urlParams_, opts...)
  3618. res, err := c.doRequest("json")
  3619. if res != nil && res.StatusCode == http.StatusNotModified {
  3620. if res.Body != nil {
  3621. res.Body.Close()
  3622. }
  3623. return nil, &googleapi.Error{
  3624. Code: res.StatusCode,
  3625. Header: res.Header,
  3626. }
  3627. }
  3628. if err != nil {
  3629. return nil, err
  3630. }
  3631. defer googleapi.CloseBody(res)
  3632. if err := googleapi.CheckResponse(res); err != nil {
  3633. return nil, err
  3634. }
  3635. ret := &Page{
  3636. ServerResponse: googleapi.ServerResponse{
  3637. Header: res.Header,
  3638. HTTPStatusCode: res.StatusCode,
  3639. },
  3640. }
  3641. target := &ret
  3642. if err := gensupport.DecodeResponse(target, res); err != nil {
  3643. return nil, err
  3644. }
  3645. return ret, nil
  3646. // {
  3647. // "description": "Add a page.",
  3648. // "httpMethod": "POST",
  3649. // "id": "blogger.pages.insert",
  3650. // "parameterOrder": [
  3651. // "blogId"
  3652. // ],
  3653. // "parameters": {
  3654. // "blogId": {
  3655. // "description": "ID of the blog to add the page to.",
  3656. // "location": "path",
  3657. // "required": true,
  3658. // "type": "string"
  3659. // },
  3660. // "isDraft": {
  3661. // "description": "Whether to create the page as a draft (default: false).",
  3662. // "location": "query",
  3663. // "type": "boolean"
  3664. // }
  3665. // },
  3666. // "path": "blogs/{blogId}/pages",
  3667. // "request": {
  3668. // "$ref": "Page"
  3669. // },
  3670. // "response": {
  3671. // "$ref": "Page"
  3672. // },
  3673. // "scopes": [
  3674. // "https://www.googleapis.com/auth/blogger"
  3675. // ]
  3676. // }
  3677. }
  3678. // method id "blogger.pages.list":
  3679. type PagesListCall struct {
  3680. s *Service
  3681. blogId string
  3682. urlParams_ gensupport.URLParams
  3683. ifNoneMatch_ string
  3684. ctx_ context.Context
  3685. header_ http.Header
  3686. }
  3687. // List: Retrieves the pages for a blog, optionally including non-LIVE
  3688. // statuses.
  3689. func (r *PagesService) List(blogId string) *PagesListCall {
  3690. c := &PagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3691. c.blogId = blogId
  3692. return c
  3693. }
  3694. // FetchBodies sets the optional parameter "fetchBodies": Whether to
  3695. // retrieve the Page bodies.
  3696. func (c *PagesListCall) FetchBodies(fetchBodies bool) *PagesListCall {
  3697. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  3698. return c
  3699. }
  3700. // MaxResults sets the optional parameter "maxResults": Maximum number
  3701. // of Pages to fetch.
  3702. func (c *PagesListCall) MaxResults(maxResults int64) *PagesListCall {
  3703. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3704. return c
  3705. }
  3706. // PageToken sets the optional parameter "pageToken": Continuation token
  3707. // if the request is paged.
  3708. func (c *PagesListCall) PageToken(pageToken string) *PagesListCall {
  3709. c.urlParams_.Set("pageToken", pageToken)
  3710. return c
  3711. }
  3712. // Status sets the optional parameter "status":
  3713. //
  3714. // Possible values:
  3715. // "draft" - Draft (unpublished) Pages
  3716. // "live" - Pages that are publicly visible
  3717. func (c *PagesListCall) Status(status ...string) *PagesListCall {
  3718. c.urlParams_.SetMulti("status", append([]string{}, status...))
  3719. return c
  3720. }
  3721. // View sets the optional parameter "view": Access level with which to
  3722. // view the returned result. Note that some fields require elevated
  3723. // access.
  3724. //
  3725. // Possible values:
  3726. // "ADMIN" - Admin level detail
  3727. // "AUTHOR" - Author level detail
  3728. // "READER" - Reader level detail
  3729. func (c *PagesListCall) View(view string) *PagesListCall {
  3730. c.urlParams_.Set("view", view)
  3731. return c
  3732. }
  3733. // Fields allows partial responses to be retrieved. See
  3734. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3735. // for more information.
  3736. func (c *PagesListCall) Fields(s ...googleapi.Field) *PagesListCall {
  3737. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3738. return c
  3739. }
  3740. // IfNoneMatch sets the optional parameter which makes the operation
  3741. // fail if the object's ETag matches the given value. This is useful for
  3742. // getting updates only after the object has changed since the last
  3743. // request. Use googleapi.IsNotModified to check whether the response
  3744. // error from Do is the result of In-None-Match.
  3745. func (c *PagesListCall) IfNoneMatch(entityTag string) *PagesListCall {
  3746. c.ifNoneMatch_ = entityTag
  3747. return c
  3748. }
  3749. // Context sets the context to be used in this call's Do method. Any
  3750. // pending HTTP request will be aborted if the provided context is
  3751. // canceled.
  3752. func (c *PagesListCall) Context(ctx context.Context) *PagesListCall {
  3753. c.ctx_ = ctx
  3754. return c
  3755. }
  3756. // Header returns an http.Header that can be modified by the caller to
  3757. // add HTTP headers to the request.
  3758. func (c *PagesListCall) Header() http.Header {
  3759. if c.header_ == nil {
  3760. c.header_ = make(http.Header)
  3761. }
  3762. return c.header_
  3763. }
  3764. func (c *PagesListCall) doRequest(alt string) (*http.Response, error) {
  3765. reqHeaders := make(http.Header)
  3766. for k, v := range c.header_ {
  3767. reqHeaders[k] = v
  3768. }
  3769. reqHeaders.Set("User-Agent", c.s.userAgent())
  3770. if c.ifNoneMatch_ != "" {
  3771. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3772. }
  3773. var body io.Reader = nil
  3774. c.urlParams_.Set("alt", alt)
  3775. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages")
  3776. urls += "?" + c.urlParams_.Encode()
  3777. req, _ := http.NewRequest("GET", urls, body)
  3778. req.Header = reqHeaders
  3779. googleapi.Expand(req.URL, map[string]string{
  3780. "blogId": c.blogId,
  3781. })
  3782. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3783. }
  3784. // Do executes the "blogger.pages.list" call.
  3785. // Exactly one of *PageList or error will be non-nil. Any non-2xx status
  3786. // code is an error. Response headers are in either
  3787. // *PageList.ServerResponse.Header or (if a response was returned at
  3788. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3789. // to check whether the returned error was because
  3790. // http.StatusNotModified was returned.
  3791. func (c *PagesListCall) Do(opts ...googleapi.CallOption) (*PageList, error) {
  3792. gensupport.SetOptions(c.urlParams_, opts...)
  3793. res, err := c.doRequest("json")
  3794. if res != nil && res.StatusCode == http.StatusNotModified {
  3795. if res.Body != nil {
  3796. res.Body.Close()
  3797. }
  3798. return nil, &googleapi.Error{
  3799. Code: res.StatusCode,
  3800. Header: res.Header,
  3801. }
  3802. }
  3803. if err != nil {
  3804. return nil, err
  3805. }
  3806. defer googleapi.CloseBody(res)
  3807. if err := googleapi.CheckResponse(res); err != nil {
  3808. return nil, err
  3809. }
  3810. ret := &PageList{
  3811. ServerResponse: googleapi.ServerResponse{
  3812. Header: res.Header,
  3813. HTTPStatusCode: res.StatusCode,
  3814. },
  3815. }
  3816. target := &ret
  3817. if err := gensupport.DecodeResponse(target, res); err != nil {
  3818. return nil, err
  3819. }
  3820. return ret, nil
  3821. // {
  3822. // "description": "Retrieves the pages for a blog, optionally including non-LIVE statuses.",
  3823. // "httpMethod": "GET",
  3824. // "id": "blogger.pages.list",
  3825. // "parameterOrder": [
  3826. // "blogId"
  3827. // ],
  3828. // "parameters": {
  3829. // "blogId": {
  3830. // "description": "ID of the blog to fetch Pages from.",
  3831. // "location": "path",
  3832. // "required": true,
  3833. // "type": "string"
  3834. // },
  3835. // "fetchBodies": {
  3836. // "description": "Whether to retrieve the Page bodies.",
  3837. // "location": "query",
  3838. // "type": "boolean"
  3839. // },
  3840. // "maxResults": {
  3841. // "description": "Maximum number of Pages to fetch.",
  3842. // "format": "uint32",
  3843. // "location": "query",
  3844. // "type": "integer"
  3845. // },
  3846. // "pageToken": {
  3847. // "description": "Continuation token if the request is paged.",
  3848. // "location": "query",
  3849. // "type": "string"
  3850. // },
  3851. // "status": {
  3852. // "enum": [
  3853. // "draft",
  3854. // "live"
  3855. // ],
  3856. // "enumDescriptions": [
  3857. // "Draft (unpublished) Pages",
  3858. // "Pages that are publicly visible"
  3859. // ],
  3860. // "location": "query",
  3861. // "repeated": true,
  3862. // "type": "string"
  3863. // },
  3864. // "view": {
  3865. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  3866. // "enum": [
  3867. // "ADMIN",
  3868. // "AUTHOR",
  3869. // "READER"
  3870. // ],
  3871. // "enumDescriptions": [
  3872. // "Admin level detail",
  3873. // "Author level detail",
  3874. // "Reader level detail"
  3875. // ],
  3876. // "location": "query",
  3877. // "type": "string"
  3878. // }
  3879. // },
  3880. // "path": "blogs/{blogId}/pages",
  3881. // "response": {
  3882. // "$ref": "PageList"
  3883. // },
  3884. // "scopes": [
  3885. // "https://www.googleapis.com/auth/blogger",
  3886. // "https://www.googleapis.com/auth/blogger.readonly"
  3887. // ]
  3888. // }
  3889. }
  3890. // Pages invokes f for each page of results.
  3891. // A non-nil error returned from f will halt the iteration.
  3892. // The provided context supersedes any context provided to the Context method.
  3893. func (c *PagesListCall) Pages(ctx context.Context, f func(*PageList) error) error {
  3894. c.ctx_ = ctx
  3895. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3896. for {
  3897. x, err := c.Do()
  3898. if err != nil {
  3899. return err
  3900. }
  3901. if err := f(x); err != nil {
  3902. return err
  3903. }
  3904. if x.NextPageToken == "" {
  3905. return nil
  3906. }
  3907. c.PageToken(x.NextPageToken)
  3908. }
  3909. }
  3910. // method id "blogger.pages.patch":
  3911. type PagesPatchCall struct {
  3912. s *Service
  3913. blogId string
  3914. pageId string
  3915. page *Page
  3916. urlParams_ gensupport.URLParams
  3917. ctx_ context.Context
  3918. header_ http.Header
  3919. }
  3920. // Patch: Update a page. This method supports patch semantics.
  3921. func (r *PagesService) Patch(blogId string, pageId string, page *Page) *PagesPatchCall {
  3922. c := &PagesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3923. c.blogId = blogId
  3924. c.pageId = pageId
  3925. c.page = page
  3926. return c
  3927. }
  3928. // Publish sets the optional parameter "publish": Whether a publish
  3929. // action should be performed when the page is updated (default: false).
  3930. func (c *PagesPatchCall) Publish(publish bool) *PagesPatchCall {
  3931. c.urlParams_.Set("publish", fmt.Sprint(publish))
  3932. return c
  3933. }
  3934. // Revert sets the optional parameter "revert": Whether a revert action
  3935. // should be performed when the page is updated (default: false).
  3936. func (c *PagesPatchCall) Revert(revert bool) *PagesPatchCall {
  3937. c.urlParams_.Set("revert", fmt.Sprint(revert))
  3938. return c
  3939. }
  3940. // Fields allows partial responses to be retrieved. See
  3941. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3942. // for more information.
  3943. func (c *PagesPatchCall) Fields(s ...googleapi.Field) *PagesPatchCall {
  3944. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3945. return c
  3946. }
  3947. // Context sets the context to be used in this call's Do method. Any
  3948. // pending HTTP request will be aborted if the provided context is
  3949. // canceled.
  3950. func (c *PagesPatchCall) Context(ctx context.Context) *PagesPatchCall {
  3951. c.ctx_ = ctx
  3952. return c
  3953. }
  3954. // Header returns an http.Header that can be modified by the caller to
  3955. // add HTTP headers to the request.
  3956. func (c *PagesPatchCall) Header() http.Header {
  3957. if c.header_ == nil {
  3958. c.header_ = make(http.Header)
  3959. }
  3960. return c.header_
  3961. }
  3962. func (c *PagesPatchCall) doRequest(alt string) (*http.Response, error) {
  3963. reqHeaders := make(http.Header)
  3964. for k, v := range c.header_ {
  3965. reqHeaders[k] = v
  3966. }
  3967. reqHeaders.Set("User-Agent", c.s.userAgent())
  3968. var body io.Reader = nil
  3969. body, err := googleapi.WithoutDataWrapper.JSONReader(c.page)
  3970. if err != nil {
  3971. return nil, err
  3972. }
  3973. reqHeaders.Set("Content-Type", "application/json")
  3974. c.urlParams_.Set("alt", alt)
  3975. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  3976. urls += "?" + c.urlParams_.Encode()
  3977. req, _ := http.NewRequest("PATCH", urls, body)
  3978. req.Header = reqHeaders
  3979. googleapi.Expand(req.URL, map[string]string{
  3980. "blogId": c.blogId,
  3981. "pageId": c.pageId,
  3982. })
  3983. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3984. }
  3985. // Do executes the "blogger.pages.patch" call.
  3986. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  3987. // code is an error. Response headers are in either
  3988. // *Page.ServerResponse.Header or (if a response was returned at all) in
  3989. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3990. // whether the returned error was because http.StatusNotModified was
  3991. // returned.
  3992. func (c *PagesPatchCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  3993. gensupport.SetOptions(c.urlParams_, opts...)
  3994. res, err := c.doRequest("json")
  3995. if res != nil && res.StatusCode == http.StatusNotModified {
  3996. if res.Body != nil {
  3997. res.Body.Close()
  3998. }
  3999. return nil, &googleapi.Error{
  4000. Code: res.StatusCode,
  4001. Header: res.Header,
  4002. }
  4003. }
  4004. if err != nil {
  4005. return nil, err
  4006. }
  4007. defer googleapi.CloseBody(res)
  4008. if err := googleapi.CheckResponse(res); err != nil {
  4009. return nil, err
  4010. }
  4011. ret := &Page{
  4012. ServerResponse: googleapi.ServerResponse{
  4013. Header: res.Header,
  4014. HTTPStatusCode: res.StatusCode,
  4015. },
  4016. }
  4017. target := &ret
  4018. if err := gensupport.DecodeResponse(target, res); err != nil {
  4019. return nil, err
  4020. }
  4021. return ret, nil
  4022. // {
  4023. // "description": "Update a page. This method supports patch semantics.",
  4024. // "httpMethod": "PATCH",
  4025. // "id": "blogger.pages.patch",
  4026. // "parameterOrder": [
  4027. // "blogId",
  4028. // "pageId"
  4029. // ],
  4030. // "parameters": {
  4031. // "blogId": {
  4032. // "description": "The ID of the Blog.",
  4033. // "location": "path",
  4034. // "required": true,
  4035. // "type": "string"
  4036. // },
  4037. // "pageId": {
  4038. // "description": "The ID of the Page.",
  4039. // "location": "path",
  4040. // "required": true,
  4041. // "type": "string"
  4042. // },
  4043. // "publish": {
  4044. // "description": "Whether a publish action should be performed when the page is updated (default: false).",
  4045. // "location": "query",
  4046. // "type": "boolean"
  4047. // },
  4048. // "revert": {
  4049. // "description": "Whether a revert action should be performed when the page is updated (default: false).",
  4050. // "location": "query",
  4051. // "type": "boolean"
  4052. // }
  4053. // },
  4054. // "path": "blogs/{blogId}/pages/{pageId}",
  4055. // "request": {
  4056. // "$ref": "Page"
  4057. // },
  4058. // "response": {
  4059. // "$ref": "Page"
  4060. // },
  4061. // "scopes": [
  4062. // "https://www.googleapis.com/auth/blogger"
  4063. // ]
  4064. // }
  4065. }
  4066. // method id "blogger.pages.publish":
  4067. type PagesPublishCall struct {
  4068. s *Service
  4069. blogId string
  4070. pageId string
  4071. urlParams_ gensupport.URLParams
  4072. ctx_ context.Context
  4073. header_ http.Header
  4074. }
  4075. // Publish: Publishes a draft page.
  4076. func (r *PagesService) Publish(blogId string, pageId string) *PagesPublishCall {
  4077. c := &PagesPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4078. c.blogId = blogId
  4079. c.pageId = pageId
  4080. return c
  4081. }
  4082. // Fields allows partial responses to be retrieved. See
  4083. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4084. // for more information.
  4085. func (c *PagesPublishCall) Fields(s ...googleapi.Field) *PagesPublishCall {
  4086. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4087. return c
  4088. }
  4089. // Context sets the context to be used in this call's Do method. Any
  4090. // pending HTTP request will be aborted if the provided context is
  4091. // canceled.
  4092. func (c *PagesPublishCall) Context(ctx context.Context) *PagesPublishCall {
  4093. c.ctx_ = ctx
  4094. return c
  4095. }
  4096. // Header returns an http.Header that can be modified by the caller to
  4097. // add HTTP headers to the request.
  4098. func (c *PagesPublishCall) Header() http.Header {
  4099. if c.header_ == nil {
  4100. c.header_ = make(http.Header)
  4101. }
  4102. return c.header_
  4103. }
  4104. func (c *PagesPublishCall) doRequest(alt string) (*http.Response, error) {
  4105. reqHeaders := make(http.Header)
  4106. for k, v := range c.header_ {
  4107. reqHeaders[k] = v
  4108. }
  4109. reqHeaders.Set("User-Agent", c.s.userAgent())
  4110. var body io.Reader = nil
  4111. c.urlParams_.Set("alt", alt)
  4112. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}/publish")
  4113. urls += "?" + c.urlParams_.Encode()
  4114. req, _ := http.NewRequest("POST", urls, body)
  4115. req.Header = reqHeaders
  4116. googleapi.Expand(req.URL, map[string]string{
  4117. "blogId": c.blogId,
  4118. "pageId": c.pageId,
  4119. })
  4120. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4121. }
  4122. // Do executes the "blogger.pages.publish" call.
  4123. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  4124. // code is an error. Response headers are in either
  4125. // *Page.ServerResponse.Header or (if a response was returned at all) in
  4126. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4127. // whether the returned error was because http.StatusNotModified was
  4128. // returned.
  4129. func (c *PagesPublishCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  4130. gensupport.SetOptions(c.urlParams_, opts...)
  4131. res, err := c.doRequest("json")
  4132. if res != nil && res.StatusCode == http.StatusNotModified {
  4133. if res.Body != nil {
  4134. res.Body.Close()
  4135. }
  4136. return nil, &googleapi.Error{
  4137. Code: res.StatusCode,
  4138. Header: res.Header,
  4139. }
  4140. }
  4141. if err != nil {
  4142. return nil, err
  4143. }
  4144. defer googleapi.CloseBody(res)
  4145. if err := googleapi.CheckResponse(res); err != nil {
  4146. return nil, err
  4147. }
  4148. ret := &Page{
  4149. ServerResponse: googleapi.ServerResponse{
  4150. Header: res.Header,
  4151. HTTPStatusCode: res.StatusCode,
  4152. },
  4153. }
  4154. target := &ret
  4155. if err := gensupport.DecodeResponse(target, res); err != nil {
  4156. return nil, err
  4157. }
  4158. return ret, nil
  4159. // {
  4160. // "description": "Publishes a draft page.",
  4161. // "httpMethod": "POST",
  4162. // "id": "blogger.pages.publish",
  4163. // "parameterOrder": [
  4164. // "blogId",
  4165. // "pageId"
  4166. // ],
  4167. // "parameters": {
  4168. // "blogId": {
  4169. // "description": "The ID of the blog.",
  4170. // "location": "path",
  4171. // "required": true,
  4172. // "type": "string"
  4173. // },
  4174. // "pageId": {
  4175. // "description": "The ID of the page.",
  4176. // "location": "path",
  4177. // "required": true,
  4178. // "type": "string"
  4179. // }
  4180. // },
  4181. // "path": "blogs/{blogId}/pages/{pageId}/publish",
  4182. // "response": {
  4183. // "$ref": "Page"
  4184. // },
  4185. // "scopes": [
  4186. // "https://www.googleapis.com/auth/blogger"
  4187. // ]
  4188. // }
  4189. }
  4190. // method id "blogger.pages.revert":
  4191. type PagesRevertCall struct {
  4192. s *Service
  4193. blogId string
  4194. pageId string
  4195. urlParams_ gensupport.URLParams
  4196. ctx_ context.Context
  4197. header_ http.Header
  4198. }
  4199. // Revert: Revert a published or scheduled page to draft state.
  4200. func (r *PagesService) Revert(blogId string, pageId string) *PagesRevertCall {
  4201. c := &PagesRevertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4202. c.blogId = blogId
  4203. c.pageId = pageId
  4204. return c
  4205. }
  4206. // Fields allows partial responses to be retrieved. See
  4207. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4208. // for more information.
  4209. func (c *PagesRevertCall) Fields(s ...googleapi.Field) *PagesRevertCall {
  4210. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4211. return c
  4212. }
  4213. // Context sets the context to be used in this call's Do method. Any
  4214. // pending HTTP request will be aborted if the provided context is
  4215. // canceled.
  4216. func (c *PagesRevertCall) Context(ctx context.Context) *PagesRevertCall {
  4217. c.ctx_ = ctx
  4218. return c
  4219. }
  4220. // Header returns an http.Header that can be modified by the caller to
  4221. // add HTTP headers to the request.
  4222. func (c *PagesRevertCall) Header() http.Header {
  4223. if c.header_ == nil {
  4224. c.header_ = make(http.Header)
  4225. }
  4226. return c.header_
  4227. }
  4228. func (c *PagesRevertCall) doRequest(alt string) (*http.Response, error) {
  4229. reqHeaders := make(http.Header)
  4230. for k, v := range c.header_ {
  4231. reqHeaders[k] = v
  4232. }
  4233. reqHeaders.Set("User-Agent", c.s.userAgent())
  4234. var body io.Reader = nil
  4235. c.urlParams_.Set("alt", alt)
  4236. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}/revert")
  4237. urls += "?" + c.urlParams_.Encode()
  4238. req, _ := http.NewRequest("POST", urls, body)
  4239. req.Header = reqHeaders
  4240. googleapi.Expand(req.URL, map[string]string{
  4241. "blogId": c.blogId,
  4242. "pageId": c.pageId,
  4243. })
  4244. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4245. }
  4246. // Do executes the "blogger.pages.revert" call.
  4247. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  4248. // code is an error. Response headers are in either
  4249. // *Page.ServerResponse.Header or (if a response was returned at all) in
  4250. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4251. // whether the returned error was because http.StatusNotModified was
  4252. // returned.
  4253. func (c *PagesRevertCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  4254. gensupport.SetOptions(c.urlParams_, opts...)
  4255. res, err := c.doRequest("json")
  4256. if res != nil && res.StatusCode == http.StatusNotModified {
  4257. if res.Body != nil {
  4258. res.Body.Close()
  4259. }
  4260. return nil, &googleapi.Error{
  4261. Code: res.StatusCode,
  4262. Header: res.Header,
  4263. }
  4264. }
  4265. if err != nil {
  4266. return nil, err
  4267. }
  4268. defer googleapi.CloseBody(res)
  4269. if err := googleapi.CheckResponse(res); err != nil {
  4270. return nil, err
  4271. }
  4272. ret := &Page{
  4273. ServerResponse: googleapi.ServerResponse{
  4274. Header: res.Header,
  4275. HTTPStatusCode: res.StatusCode,
  4276. },
  4277. }
  4278. target := &ret
  4279. if err := gensupport.DecodeResponse(target, res); err != nil {
  4280. return nil, err
  4281. }
  4282. return ret, nil
  4283. // {
  4284. // "description": "Revert a published or scheduled page to draft state.",
  4285. // "httpMethod": "POST",
  4286. // "id": "blogger.pages.revert",
  4287. // "parameterOrder": [
  4288. // "blogId",
  4289. // "pageId"
  4290. // ],
  4291. // "parameters": {
  4292. // "blogId": {
  4293. // "description": "The ID of the blog.",
  4294. // "location": "path",
  4295. // "required": true,
  4296. // "type": "string"
  4297. // },
  4298. // "pageId": {
  4299. // "description": "The ID of the page.",
  4300. // "location": "path",
  4301. // "required": true,
  4302. // "type": "string"
  4303. // }
  4304. // },
  4305. // "path": "blogs/{blogId}/pages/{pageId}/revert",
  4306. // "response": {
  4307. // "$ref": "Page"
  4308. // },
  4309. // "scopes": [
  4310. // "https://www.googleapis.com/auth/blogger"
  4311. // ]
  4312. // }
  4313. }
  4314. // method id "blogger.pages.update":
  4315. type PagesUpdateCall struct {
  4316. s *Service
  4317. blogId string
  4318. pageId string
  4319. page *Page
  4320. urlParams_ gensupport.URLParams
  4321. ctx_ context.Context
  4322. header_ http.Header
  4323. }
  4324. // Update: Update a page.
  4325. func (r *PagesService) Update(blogId string, pageId string, page *Page) *PagesUpdateCall {
  4326. c := &PagesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4327. c.blogId = blogId
  4328. c.pageId = pageId
  4329. c.page = page
  4330. return c
  4331. }
  4332. // Publish sets the optional parameter "publish": Whether a publish
  4333. // action should be performed when the page is updated (default: false).
  4334. func (c *PagesUpdateCall) Publish(publish bool) *PagesUpdateCall {
  4335. c.urlParams_.Set("publish", fmt.Sprint(publish))
  4336. return c
  4337. }
  4338. // Revert sets the optional parameter "revert": Whether a revert action
  4339. // should be performed when the page is updated (default: false).
  4340. func (c *PagesUpdateCall) Revert(revert bool) *PagesUpdateCall {
  4341. c.urlParams_.Set("revert", fmt.Sprint(revert))
  4342. return c
  4343. }
  4344. // Fields allows partial responses to be retrieved. See
  4345. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4346. // for more information.
  4347. func (c *PagesUpdateCall) Fields(s ...googleapi.Field) *PagesUpdateCall {
  4348. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4349. return c
  4350. }
  4351. // Context sets the context to be used in this call's Do method. Any
  4352. // pending HTTP request will be aborted if the provided context is
  4353. // canceled.
  4354. func (c *PagesUpdateCall) Context(ctx context.Context) *PagesUpdateCall {
  4355. c.ctx_ = ctx
  4356. return c
  4357. }
  4358. // Header returns an http.Header that can be modified by the caller to
  4359. // add HTTP headers to the request.
  4360. func (c *PagesUpdateCall) Header() http.Header {
  4361. if c.header_ == nil {
  4362. c.header_ = make(http.Header)
  4363. }
  4364. return c.header_
  4365. }
  4366. func (c *PagesUpdateCall) doRequest(alt string) (*http.Response, error) {
  4367. reqHeaders := make(http.Header)
  4368. for k, v := range c.header_ {
  4369. reqHeaders[k] = v
  4370. }
  4371. reqHeaders.Set("User-Agent", c.s.userAgent())
  4372. var body io.Reader = nil
  4373. body, err := googleapi.WithoutDataWrapper.JSONReader(c.page)
  4374. if err != nil {
  4375. return nil, err
  4376. }
  4377. reqHeaders.Set("Content-Type", "application/json")
  4378. c.urlParams_.Set("alt", alt)
  4379. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/pages/{pageId}")
  4380. urls += "?" + c.urlParams_.Encode()
  4381. req, _ := http.NewRequest("PUT", urls, body)
  4382. req.Header = reqHeaders
  4383. googleapi.Expand(req.URL, map[string]string{
  4384. "blogId": c.blogId,
  4385. "pageId": c.pageId,
  4386. })
  4387. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4388. }
  4389. // Do executes the "blogger.pages.update" call.
  4390. // Exactly one of *Page or error will be non-nil. Any non-2xx status
  4391. // code is an error. Response headers are in either
  4392. // *Page.ServerResponse.Header or (if a response was returned at all) in
  4393. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4394. // whether the returned error was because http.StatusNotModified was
  4395. // returned.
  4396. func (c *PagesUpdateCall) Do(opts ...googleapi.CallOption) (*Page, error) {
  4397. gensupport.SetOptions(c.urlParams_, opts...)
  4398. res, err := c.doRequest("json")
  4399. if res != nil && res.StatusCode == http.StatusNotModified {
  4400. if res.Body != nil {
  4401. res.Body.Close()
  4402. }
  4403. return nil, &googleapi.Error{
  4404. Code: res.StatusCode,
  4405. Header: res.Header,
  4406. }
  4407. }
  4408. if err != nil {
  4409. return nil, err
  4410. }
  4411. defer googleapi.CloseBody(res)
  4412. if err := googleapi.CheckResponse(res); err != nil {
  4413. return nil, err
  4414. }
  4415. ret := &Page{
  4416. ServerResponse: googleapi.ServerResponse{
  4417. Header: res.Header,
  4418. HTTPStatusCode: res.StatusCode,
  4419. },
  4420. }
  4421. target := &ret
  4422. if err := gensupport.DecodeResponse(target, res); err != nil {
  4423. return nil, err
  4424. }
  4425. return ret, nil
  4426. // {
  4427. // "description": "Update a page.",
  4428. // "httpMethod": "PUT",
  4429. // "id": "blogger.pages.update",
  4430. // "parameterOrder": [
  4431. // "blogId",
  4432. // "pageId"
  4433. // ],
  4434. // "parameters": {
  4435. // "blogId": {
  4436. // "description": "The ID of the Blog.",
  4437. // "location": "path",
  4438. // "required": true,
  4439. // "type": "string"
  4440. // },
  4441. // "pageId": {
  4442. // "description": "The ID of the Page.",
  4443. // "location": "path",
  4444. // "required": true,
  4445. // "type": "string"
  4446. // },
  4447. // "publish": {
  4448. // "description": "Whether a publish action should be performed when the page is updated (default: false).",
  4449. // "location": "query",
  4450. // "type": "boolean"
  4451. // },
  4452. // "revert": {
  4453. // "description": "Whether a revert action should be performed when the page is updated (default: false).",
  4454. // "location": "query",
  4455. // "type": "boolean"
  4456. // }
  4457. // },
  4458. // "path": "blogs/{blogId}/pages/{pageId}",
  4459. // "request": {
  4460. // "$ref": "Page"
  4461. // },
  4462. // "response": {
  4463. // "$ref": "Page"
  4464. // },
  4465. // "scopes": [
  4466. // "https://www.googleapis.com/auth/blogger"
  4467. // ]
  4468. // }
  4469. }
  4470. // method id "blogger.postUserInfos.get":
  4471. type PostUserInfosGetCall struct {
  4472. s *Service
  4473. userId string
  4474. blogId string
  4475. postId string
  4476. urlParams_ gensupport.URLParams
  4477. ifNoneMatch_ string
  4478. ctx_ context.Context
  4479. header_ http.Header
  4480. }
  4481. // Get: Gets one post and user info pair, by post ID and user ID. The
  4482. // post user info contains per-user information about the post, such as
  4483. // access rights, specific to the user.
  4484. func (r *PostUserInfosService) Get(userId string, blogId string, postId string) *PostUserInfosGetCall {
  4485. c := &PostUserInfosGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4486. c.userId = userId
  4487. c.blogId = blogId
  4488. c.postId = postId
  4489. return c
  4490. }
  4491. // MaxComments sets the optional parameter "maxComments": Maximum number
  4492. // of comments to pull back on a post.
  4493. func (c *PostUserInfosGetCall) MaxComments(maxComments int64) *PostUserInfosGetCall {
  4494. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  4495. return c
  4496. }
  4497. // Fields allows partial responses to be retrieved. See
  4498. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4499. // for more information.
  4500. func (c *PostUserInfosGetCall) Fields(s ...googleapi.Field) *PostUserInfosGetCall {
  4501. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4502. return c
  4503. }
  4504. // IfNoneMatch sets the optional parameter which makes the operation
  4505. // fail if the object's ETag matches the given value. This is useful for
  4506. // getting updates only after the object has changed since the last
  4507. // request. Use googleapi.IsNotModified to check whether the response
  4508. // error from Do is the result of In-None-Match.
  4509. func (c *PostUserInfosGetCall) IfNoneMatch(entityTag string) *PostUserInfosGetCall {
  4510. c.ifNoneMatch_ = entityTag
  4511. return c
  4512. }
  4513. // Context sets the context to be used in this call's Do method. Any
  4514. // pending HTTP request will be aborted if the provided context is
  4515. // canceled.
  4516. func (c *PostUserInfosGetCall) Context(ctx context.Context) *PostUserInfosGetCall {
  4517. c.ctx_ = ctx
  4518. return c
  4519. }
  4520. // Header returns an http.Header that can be modified by the caller to
  4521. // add HTTP headers to the request.
  4522. func (c *PostUserInfosGetCall) Header() http.Header {
  4523. if c.header_ == nil {
  4524. c.header_ = make(http.Header)
  4525. }
  4526. return c.header_
  4527. }
  4528. func (c *PostUserInfosGetCall) doRequest(alt string) (*http.Response, error) {
  4529. reqHeaders := make(http.Header)
  4530. for k, v := range c.header_ {
  4531. reqHeaders[k] = v
  4532. }
  4533. reqHeaders.Set("User-Agent", c.s.userAgent())
  4534. if c.ifNoneMatch_ != "" {
  4535. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4536. }
  4537. var body io.Reader = nil
  4538. c.urlParams_.Set("alt", alt)
  4539. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs/{blogId}/posts/{postId}")
  4540. urls += "?" + c.urlParams_.Encode()
  4541. req, _ := http.NewRequest("GET", urls, body)
  4542. req.Header = reqHeaders
  4543. googleapi.Expand(req.URL, map[string]string{
  4544. "userId": c.userId,
  4545. "blogId": c.blogId,
  4546. "postId": c.postId,
  4547. })
  4548. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4549. }
  4550. // Do executes the "blogger.postUserInfos.get" call.
  4551. // Exactly one of *PostUserInfo or error will be non-nil. Any non-2xx
  4552. // status code is an error. Response headers are in either
  4553. // *PostUserInfo.ServerResponse.Header or (if a response was returned at
  4554. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4555. // to check whether the returned error was because
  4556. // http.StatusNotModified was returned.
  4557. func (c *PostUserInfosGetCall) Do(opts ...googleapi.CallOption) (*PostUserInfo, error) {
  4558. gensupport.SetOptions(c.urlParams_, opts...)
  4559. res, err := c.doRequest("json")
  4560. if res != nil && res.StatusCode == http.StatusNotModified {
  4561. if res.Body != nil {
  4562. res.Body.Close()
  4563. }
  4564. return nil, &googleapi.Error{
  4565. Code: res.StatusCode,
  4566. Header: res.Header,
  4567. }
  4568. }
  4569. if err != nil {
  4570. return nil, err
  4571. }
  4572. defer googleapi.CloseBody(res)
  4573. if err := googleapi.CheckResponse(res); err != nil {
  4574. return nil, err
  4575. }
  4576. ret := &PostUserInfo{
  4577. ServerResponse: googleapi.ServerResponse{
  4578. Header: res.Header,
  4579. HTTPStatusCode: res.StatusCode,
  4580. },
  4581. }
  4582. target := &ret
  4583. if err := gensupport.DecodeResponse(target, res); err != nil {
  4584. return nil, err
  4585. }
  4586. return ret, nil
  4587. // {
  4588. // "description": "Gets one post and user info pair, by post ID and user ID. The post user info contains per-user information about the post, such as access rights, specific to the user.",
  4589. // "httpMethod": "GET",
  4590. // "id": "blogger.postUserInfos.get",
  4591. // "parameterOrder": [
  4592. // "userId",
  4593. // "blogId",
  4594. // "postId"
  4595. // ],
  4596. // "parameters": {
  4597. // "blogId": {
  4598. // "description": "The ID of the blog.",
  4599. // "location": "path",
  4600. // "required": true,
  4601. // "type": "string"
  4602. // },
  4603. // "maxComments": {
  4604. // "description": "Maximum number of comments to pull back on a post.",
  4605. // "format": "uint32",
  4606. // "location": "query",
  4607. // "type": "integer"
  4608. // },
  4609. // "postId": {
  4610. // "description": "The ID of the post to get.",
  4611. // "location": "path",
  4612. // "required": true,
  4613. // "type": "string"
  4614. // },
  4615. // "userId": {
  4616. // "description": "ID of the user for the per-user information to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  4617. // "location": "path",
  4618. // "required": true,
  4619. // "type": "string"
  4620. // }
  4621. // },
  4622. // "path": "users/{userId}/blogs/{blogId}/posts/{postId}",
  4623. // "response": {
  4624. // "$ref": "PostUserInfo"
  4625. // },
  4626. // "scopes": [
  4627. // "https://www.googleapis.com/auth/blogger",
  4628. // "https://www.googleapis.com/auth/blogger.readonly"
  4629. // ]
  4630. // }
  4631. }
  4632. // method id "blogger.postUserInfos.list":
  4633. type PostUserInfosListCall struct {
  4634. s *Service
  4635. userId string
  4636. blogId string
  4637. urlParams_ gensupport.URLParams
  4638. ifNoneMatch_ string
  4639. ctx_ context.Context
  4640. header_ http.Header
  4641. }
  4642. // List: Retrieves a list of post and post user info pairs, possibly
  4643. // filtered. The post user info contains per-user information about the
  4644. // post, such as access rights, specific to the user.
  4645. func (r *PostUserInfosService) List(userId string, blogId string) *PostUserInfosListCall {
  4646. c := &PostUserInfosListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4647. c.userId = userId
  4648. c.blogId = blogId
  4649. return c
  4650. }
  4651. // EndDate sets the optional parameter "endDate": Latest post date to
  4652. // fetch, a date-time with RFC 3339 formatting.
  4653. func (c *PostUserInfosListCall) EndDate(endDate string) *PostUserInfosListCall {
  4654. c.urlParams_.Set("endDate", endDate)
  4655. return c
  4656. }
  4657. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  4658. // body content of posts is included. Default is false.
  4659. func (c *PostUserInfosListCall) FetchBodies(fetchBodies bool) *PostUserInfosListCall {
  4660. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  4661. return c
  4662. }
  4663. // Labels sets the optional parameter "labels": Comma-separated list of
  4664. // labels to search for.
  4665. func (c *PostUserInfosListCall) Labels(labels string) *PostUserInfosListCall {
  4666. c.urlParams_.Set("labels", labels)
  4667. return c
  4668. }
  4669. // MaxResults sets the optional parameter "maxResults": Maximum number
  4670. // of posts to fetch.
  4671. func (c *PostUserInfosListCall) MaxResults(maxResults int64) *PostUserInfosListCall {
  4672. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4673. return c
  4674. }
  4675. // OrderBy sets the optional parameter "orderBy": Sort order applied to
  4676. // search results. Default is published.
  4677. //
  4678. // Possible values:
  4679. // "published" - Order by the date the post was published
  4680. // "updated" - Order by the date the post was last updated
  4681. func (c *PostUserInfosListCall) OrderBy(orderBy string) *PostUserInfosListCall {
  4682. c.urlParams_.Set("orderBy", orderBy)
  4683. return c
  4684. }
  4685. // PageToken sets the optional parameter "pageToken": Continuation token
  4686. // if the request is paged.
  4687. func (c *PostUserInfosListCall) PageToken(pageToken string) *PostUserInfosListCall {
  4688. c.urlParams_.Set("pageToken", pageToken)
  4689. return c
  4690. }
  4691. // StartDate sets the optional parameter "startDate": Earliest post date
  4692. // to fetch, a date-time with RFC 3339 formatting.
  4693. func (c *PostUserInfosListCall) StartDate(startDate string) *PostUserInfosListCall {
  4694. c.urlParams_.Set("startDate", startDate)
  4695. return c
  4696. }
  4697. // Status sets the optional parameter "status":
  4698. //
  4699. // Possible values:
  4700. // "draft" - Draft posts
  4701. // "live" - Published posts
  4702. // "scheduled" - Posts that are scheduled to publish in future.
  4703. func (c *PostUserInfosListCall) Status(status ...string) *PostUserInfosListCall {
  4704. c.urlParams_.SetMulti("status", append([]string{}, status...))
  4705. return c
  4706. }
  4707. // View sets the optional parameter "view": Access level with which to
  4708. // view the returned result. Note that some fields require elevated
  4709. // access.
  4710. //
  4711. // Possible values:
  4712. // "ADMIN" - Admin level detail
  4713. // "AUTHOR" - Author level detail
  4714. // "READER" - Reader level detail
  4715. func (c *PostUserInfosListCall) View(view string) *PostUserInfosListCall {
  4716. c.urlParams_.Set("view", view)
  4717. return c
  4718. }
  4719. // Fields allows partial responses to be retrieved. See
  4720. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4721. // for more information.
  4722. func (c *PostUserInfosListCall) Fields(s ...googleapi.Field) *PostUserInfosListCall {
  4723. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4724. return c
  4725. }
  4726. // IfNoneMatch sets the optional parameter which makes the operation
  4727. // fail if the object's ETag matches the given value. This is useful for
  4728. // getting updates only after the object has changed since the last
  4729. // request. Use googleapi.IsNotModified to check whether the response
  4730. // error from Do is the result of In-None-Match.
  4731. func (c *PostUserInfosListCall) IfNoneMatch(entityTag string) *PostUserInfosListCall {
  4732. c.ifNoneMatch_ = entityTag
  4733. return c
  4734. }
  4735. // Context sets the context to be used in this call's Do method. Any
  4736. // pending HTTP request will be aborted if the provided context is
  4737. // canceled.
  4738. func (c *PostUserInfosListCall) Context(ctx context.Context) *PostUserInfosListCall {
  4739. c.ctx_ = ctx
  4740. return c
  4741. }
  4742. // Header returns an http.Header that can be modified by the caller to
  4743. // add HTTP headers to the request.
  4744. func (c *PostUserInfosListCall) Header() http.Header {
  4745. if c.header_ == nil {
  4746. c.header_ = make(http.Header)
  4747. }
  4748. return c.header_
  4749. }
  4750. func (c *PostUserInfosListCall) doRequest(alt string) (*http.Response, error) {
  4751. reqHeaders := make(http.Header)
  4752. for k, v := range c.header_ {
  4753. reqHeaders[k] = v
  4754. }
  4755. reqHeaders.Set("User-Agent", c.s.userAgent())
  4756. if c.ifNoneMatch_ != "" {
  4757. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4758. }
  4759. var body io.Reader = nil
  4760. c.urlParams_.Set("alt", alt)
  4761. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}/blogs/{blogId}/posts")
  4762. urls += "?" + c.urlParams_.Encode()
  4763. req, _ := http.NewRequest("GET", urls, body)
  4764. req.Header = reqHeaders
  4765. googleapi.Expand(req.URL, map[string]string{
  4766. "userId": c.userId,
  4767. "blogId": c.blogId,
  4768. })
  4769. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4770. }
  4771. // Do executes the "blogger.postUserInfos.list" call.
  4772. // Exactly one of *PostUserInfosList or error will be non-nil. Any
  4773. // non-2xx status code is an error. Response headers are in either
  4774. // *PostUserInfosList.ServerResponse.Header or (if a response was
  4775. // returned at all) in error.(*googleapi.Error).Header. Use
  4776. // googleapi.IsNotModified to check whether the returned error was
  4777. // because http.StatusNotModified was returned.
  4778. func (c *PostUserInfosListCall) Do(opts ...googleapi.CallOption) (*PostUserInfosList, error) {
  4779. gensupport.SetOptions(c.urlParams_, opts...)
  4780. res, err := c.doRequest("json")
  4781. if res != nil && res.StatusCode == http.StatusNotModified {
  4782. if res.Body != nil {
  4783. res.Body.Close()
  4784. }
  4785. return nil, &googleapi.Error{
  4786. Code: res.StatusCode,
  4787. Header: res.Header,
  4788. }
  4789. }
  4790. if err != nil {
  4791. return nil, err
  4792. }
  4793. defer googleapi.CloseBody(res)
  4794. if err := googleapi.CheckResponse(res); err != nil {
  4795. return nil, err
  4796. }
  4797. ret := &PostUserInfosList{
  4798. ServerResponse: googleapi.ServerResponse{
  4799. Header: res.Header,
  4800. HTTPStatusCode: res.StatusCode,
  4801. },
  4802. }
  4803. target := &ret
  4804. if err := gensupport.DecodeResponse(target, res); err != nil {
  4805. return nil, err
  4806. }
  4807. return ret, nil
  4808. // {
  4809. // "description": "Retrieves a list of post and post user info pairs, possibly filtered. The post user info contains per-user information about the post, such as access rights, specific to the user.",
  4810. // "httpMethod": "GET",
  4811. // "id": "blogger.postUserInfos.list",
  4812. // "parameterOrder": [
  4813. // "userId",
  4814. // "blogId"
  4815. // ],
  4816. // "parameters": {
  4817. // "blogId": {
  4818. // "description": "ID of the blog to fetch posts from.",
  4819. // "location": "path",
  4820. // "required": true,
  4821. // "type": "string"
  4822. // },
  4823. // "endDate": {
  4824. // "description": "Latest post date to fetch, a date-time with RFC 3339 formatting.",
  4825. // "format": "date-time",
  4826. // "location": "query",
  4827. // "type": "string"
  4828. // },
  4829. // "fetchBodies": {
  4830. // "default": "false",
  4831. // "description": "Whether the body content of posts is included. Default is false.",
  4832. // "location": "query",
  4833. // "type": "boolean"
  4834. // },
  4835. // "labels": {
  4836. // "description": "Comma-separated list of labels to search for.",
  4837. // "location": "query",
  4838. // "type": "string"
  4839. // },
  4840. // "maxResults": {
  4841. // "description": "Maximum number of posts to fetch.",
  4842. // "format": "uint32",
  4843. // "location": "query",
  4844. // "type": "integer"
  4845. // },
  4846. // "orderBy": {
  4847. // "default": "PUBLISHED",
  4848. // "description": "Sort order applied to search results. Default is published.",
  4849. // "enum": [
  4850. // "published",
  4851. // "updated"
  4852. // ],
  4853. // "enumDescriptions": [
  4854. // "Order by the date the post was published",
  4855. // "Order by the date the post was last updated"
  4856. // ],
  4857. // "location": "query",
  4858. // "type": "string"
  4859. // },
  4860. // "pageToken": {
  4861. // "description": "Continuation token if the request is paged.",
  4862. // "location": "query",
  4863. // "type": "string"
  4864. // },
  4865. // "startDate": {
  4866. // "description": "Earliest post date to fetch, a date-time with RFC 3339 formatting.",
  4867. // "format": "date-time",
  4868. // "location": "query",
  4869. // "type": "string"
  4870. // },
  4871. // "status": {
  4872. // "enum": [
  4873. // "draft",
  4874. // "live",
  4875. // "scheduled"
  4876. // ],
  4877. // "enumDescriptions": [
  4878. // "Draft posts",
  4879. // "Published posts",
  4880. // "Posts that are scheduled to publish in future."
  4881. // ],
  4882. // "location": "query",
  4883. // "repeated": true,
  4884. // "type": "string"
  4885. // },
  4886. // "userId": {
  4887. // "description": "ID of the user for the per-user information to be fetched. Either the word 'self' (sans quote marks) or the user's profile identifier.",
  4888. // "location": "path",
  4889. // "required": true,
  4890. // "type": "string"
  4891. // },
  4892. // "view": {
  4893. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  4894. // "enum": [
  4895. // "ADMIN",
  4896. // "AUTHOR",
  4897. // "READER"
  4898. // ],
  4899. // "enumDescriptions": [
  4900. // "Admin level detail",
  4901. // "Author level detail",
  4902. // "Reader level detail"
  4903. // ],
  4904. // "location": "query",
  4905. // "type": "string"
  4906. // }
  4907. // },
  4908. // "path": "users/{userId}/blogs/{blogId}/posts",
  4909. // "response": {
  4910. // "$ref": "PostUserInfosList"
  4911. // },
  4912. // "scopes": [
  4913. // "https://www.googleapis.com/auth/blogger",
  4914. // "https://www.googleapis.com/auth/blogger.readonly"
  4915. // ]
  4916. // }
  4917. }
  4918. // Pages invokes f for each page of results.
  4919. // A non-nil error returned from f will halt the iteration.
  4920. // The provided context supersedes any context provided to the Context method.
  4921. func (c *PostUserInfosListCall) Pages(ctx context.Context, f func(*PostUserInfosList) error) error {
  4922. c.ctx_ = ctx
  4923. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4924. for {
  4925. x, err := c.Do()
  4926. if err != nil {
  4927. return err
  4928. }
  4929. if err := f(x); err != nil {
  4930. return err
  4931. }
  4932. if x.NextPageToken == "" {
  4933. return nil
  4934. }
  4935. c.PageToken(x.NextPageToken)
  4936. }
  4937. }
  4938. // method id "blogger.posts.delete":
  4939. type PostsDeleteCall struct {
  4940. s *Service
  4941. blogId string
  4942. postId string
  4943. urlParams_ gensupport.URLParams
  4944. ctx_ context.Context
  4945. header_ http.Header
  4946. }
  4947. // Delete: Delete a post by ID.
  4948. func (r *PostsService) Delete(blogId string, postId string) *PostsDeleteCall {
  4949. c := &PostsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4950. c.blogId = blogId
  4951. c.postId = postId
  4952. return c
  4953. }
  4954. // Fields allows partial responses to be retrieved. See
  4955. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4956. // for more information.
  4957. func (c *PostsDeleteCall) Fields(s ...googleapi.Field) *PostsDeleteCall {
  4958. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4959. return c
  4960. }
  4961. // Context sets the context to be used in this call's Do method. Any
  4962. // pending HTTP request will be aborted if the provided context is
  4963. // canceled.
  4964. func (c *PostsDeleteCall) Context(ctx context.Context) *PostsDeleteCall {
  4965. c.ctx_ = ctx
  4966. return c
  4967. }
  4968. // Header returns an http.Header that can be modified by the caller to
  4969. // add HTTP headers to the request.
  4970. func (c *PostsDeleteCall) Header() http.Header {
  4971. if c.header_ == nil {
  4972. c.header_ = make(http.Header)
  4973. }
  4974. return c.header_
  4975. }
  4976. func (c *PostsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4977. reqHeaders := make(http.Header)
  4978. for k, v := range c.header_ {
  4979. reqHeaders[k] = v
  4980. }
  4981. reqHeaders.Set("User-Agent", c.s.userAgent())
  4982. var body io.Reader = nil
  4983. c.urlParams_.Set("alt", alt)
  4984. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  4985. urls += "?" + c.urlParams_.Encode()
  4986. req, _ := http.NewRequest("DELETE", urls, body)
  4987. req.Header = reqHeaders
  4988. googleapi.Expand(req.URL, map[string]string{
  4989. "blogId": c.blogId,
  4990. "postId": c.postId,
  4991. })
  4992. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4993. }
  4994. // Do executes the "blogger.posts.delete" call.
  4995. func (c *PostsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4996. gensupport.SetOptions(c.urlParams_, opts...)
  4997. res, err := c.doRequest("json")
  4998. if err != nil {
  4999. return err
  5000. }
  5001. defer googleapi.CloseBody(res)
  5002. if err := googleapi.CheckResponse(res); err != nil {
  5003. return err
  5004. }
  5005. return nil
  5006. // {
  5007. // "description": "Delete a post by ID.",
  5008. // "httpMethod": "DELETE",
  5009. // "id": "blogger.posts.delete",
  5010. // "parameterOrder": [
  5011. // "blogId",
  5012. // "postId"
  5013. // ],
  5014. // "parameters": {
  5015. // "blogId": {
  5016. // "description": "The ID of the Blog.",
  5017. // "location": "path",
  5018. // "required": true,
  5019. // "type": "string"
  5020. // },
  5021. // "postId": {
  5022. // "description": "The ID of the Post.",
  5023. // "location": "path",
  5024. // "required": true,
  5025. // "type": "string"
  5026. // }
  5027. // },
  5028. // "path": "blogs/{blogId}/posts/{postId}",
  5029. // "scopes": [
  5030. // "https://www.googleapis.com/auth/blogger"
  5031. // ]
  5032. // }
  5033. }
  5034. // method id "blogger.posts.get":
  5035. type PostsGetCall struct {
  5036. s *Service
  5037. blogId string
  5038. postId string
  5039. urlParams_ gensupport.URLParams
  5040. ifNoneMatch_ string
  5041. ctx_ context.Context
  5042. header_ http.Header
  5043. }
  5044. // Get: Get a post by ID.
  5045. func (r *PostsService) Get(blogId string, postId string) *PostsGetCall {
  5046. c := &PostsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5047. c.blogId = blogId
  5048. c.postId = postId
  5049. return c
  5050. }
  5051. // FetchBody sets the optional parameter "fetchBody": Whether the body
  5052. // content of the post is included (default: true). This should be set
  5053. // to false when the post bodies are not required, to help minimize
  5054. // traffic.
  5055. func (c *PostsGetCall) FetchBody(fetchBody bool) *PostsGetCall {
  5056. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  5057. return c
  5058. }
  5059. // FetchImages sets the optional parameter "fetchImages": Whether image
  5060. // URL metadata for each post is included (default: false).
  5061. func (c *PostsGetCall) FetchImages(fetchImages bool) *PostsGetCall {
  5062. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  5063. return c
  5064. }
  5065. // MaxComments sets the optional parameter "maxComments": Maximum number
  5066. // of comments to pull back on a post.
  5067. func (c *PostsGetCall) MaxComments(maxComments int64) *PostsGetCall {
  5068. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  5069. return c
  5070. }
  5071. // View sets the optional parameter "view": Access level with which to
  5072. // view the returned result. Note that some fields require elevated
  5073. // access.
  5074. //
  5075. // Possible values:
  5076. // "ADMIN" - Admin level detail
  5077. // "AUTHOR" - Author level detail
  5078. // "READER" - Reader level detail
  5079. func (c *PostsGetCall) View(view string) *PostsGetCall {
  5080. c.urlParams_.Set("view", view)
  5081. return c
  5082. }
  5083. // Fields allows partial responses to be retrieved. See
  5084. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5085. // for more information.
  5086. func (c *PostsGetCall) Fields(s ...googleapi.Field) *PostsGetCall {
  5087. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5088. return c
  5089. }
  5090. // IfNoneMatch sets the optional parameter which makes the operation
  5091. // fail if the object's ETag matches the given value. This is useful for
  5092. // getting updates only after the object has changed since the last
  5093. // request. Use googleapi.IsNotModified to check whether the response
  5094. // error from Do is the result of In-None-Match.
  5095. func (c *PostsGetCall) IfNoneMatch(entityTag string) *PostsGetCall {
  5096. c.ifNoneMatch_ = entityTag
  5097. return c
  5098. }
  5099. // Context sets the context to be used in this call's Do method. Any
  5100. // pending HTTP request will be aborted if the provided context is
  5101. // canceled.
  5102. func (c *PostsGetCall) Context(ctx context.Context) *PostsGetCall {
  5103. c.ctx_ = ctx
  5104. return c
  5105. }
  5106. // Header returns an http.Header that can be modified by the caller to
  5107. // add HTTP headers to the request.
  5108. func (c *PostsGetCall) Header() http.Header {
  5109. if c.header_ == nil {
  5110. c.header_ = make(http.Header)
  5111. }
  5112. return c.header_
  5113. }
  5114. func (c *PostsGetCall) doRequest(alt string) (*http.Response, error) {
  5115. reqHeaders := make(http.Header)
  5116. for k, v := range c.header_ {
  5117. reqHeaders[k] = v
  5118. }
  5119. reqHeaders.Set("User-Agent", c.s.userAgent())
  5120. if c.ifNoneMatch_ != "" {
  5121. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5122. }
  5123. var body io.Reader = nil
  5124. c.urlParams_.Set("alt", alt)
  5125. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  5126. urls += "?" + c.urlParams_.Encode()
  5127. req, _ := http.NewRequest("GET", urls, body)
  5128. req.Header = reqHeaders
  5129. googleapi.Expand(req.URL, map[string]string{
  5130. "blogId": c.blogId,
  5131. "postId": c.postId,
  5132. })
  5133. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5134. }
  5135. // Do executes the "blogger.posts.get" call.
  5136. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5137. // code is an error. Response headers are in either
  5138. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5139. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5140. // whether the returned error was because http.StatusNotModified was
  5141. // returned.
  5142. func (c *PostsGetCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5143. gensupport.SetOptions(c.urlParams_, opts...)
  5144. res, err := c.doRequest("json")
  5145. if res != nil && res.StatusCode == http.StatusNotModified {
  5146. if res.Body != nil {
  5147. res.Body.Close()
  5148. }
  5149. return nil, &googleapi.Error{
  5150. Code: res.StatusCode,
  5151. Header: res.Header,
  5152. }
  5153. }
  5154. if err != nil {
  5155. return nil, err
  5156. }
  5157. defer googleapi.CloseBody(res)
  5158. if err := googleapi.CheckResponse(res); err != nil {
  5159. return nil, err
  5160. }
  5161. ret := &Post{
  5162. ServerResponse: googleapi.ServerResponse{
  5163. Header: res.Header,
  5164. HTTPStatusCode: res.StatusCode,
  5165. },
  5166. }
  5167. target := &ret
  5168. if err := gensupport.DecodeResponse(target, res); err != nil {
  5169. return nil, err
  5170. }
  5171. return ret, nil
  5172. // {
  5173. // "description": "Get a post by ID.",
  5174. // "httpMethod": "GET",
  5175. // "id": "blogger.posts.get",
  5176. // "parameterOrder": [
  5177. // "blogId",
  5178. // "postId"
  5179. // ],
  5180. // "parameters": {
  5181. // "blogId": {
  5182. // "description": "ID of the blog to fetch the post from.",
  5183. // "location": "path",
  5184. // "required": true,
  5185. // "type": "string"
  5186. // },
  5187. // "fetchBody": {
  5188. // "default": "true",
  5189. // "description": "Whether the body content of the post is included (default: true). This should be set to false when the post bodies are not required, to help minimize traffic.",
  5190. // "location": "query",
  5191. // "type": "boolean"
  5192. // },
  5193. // "fetchImages": {
  5194. // "description": "Whether image URL metadata for each post is included (default: false).",
  5195. // "location": "query",
  5196. // "type": "boolean"
  5197. // },
  5198. // "maxComments": {
  5199. // "description": "Maximum number of comments to pull back on a post.",
  5200. // "format": "uint32",
  5201. // "location": "query",
  5202. // "type": "integer"
  5203. // },
  5204. // "postId": {
  5205. // "description": "The ID of the post",
  5206. // "location": "path",
  5207. // "required": true,
  5208. // "type": "string"
  5209. // },
  5210. // "view": {
  5211. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  5212. // "enum": [
  5213. // "ADMIN",
  5214. // "AUTHOR",
  5215. // "READER"
  5216. // ],
  5217. // "enumDescriptions": [
  5218. // "Admin level detail",
  5219. // "Author level detail",
  5220. // "Reader level detail"
  5221. // ],
  5222. // "location": "query",
  5223. // "type": "string"
  5224. // }
  5225. // },
  5226. // "path": "blogs/{blogId}/posts/{postId}",
  5227. // "response": {
  5228. // "$ref": "Post"
  5229. // },
  5230. // "scopes": [
  5231. // "https://www.googleapis.com/auth/blogger",
  5232. // "https://www.googleapis.com/auth/blogger.readonly"
  5233. // ]
  5234. // }
  5235. }
  5236. // method id "blogger.posts.getByPath":
  5237. type PostsGetByPathCall struct {
  5238. s *Service
  5239. blogId string
  5240. urlParams_ gensupport.URLParams
  5241. ifNoneMatch_ string
  5242. ctx_ context.Context
  5243. header_ http.Header
  5244. }
  5245. // GetByPath: Retrieve a Post by Path.
  5246. func (r *PostsService) GetByPath(blogId string, path string) *PostsGetByPathCall {
  5247. c := &PostsGetByPathCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5248. c.blogId = blogId
  5249. c.urlParams_.Set("path", path)
  5250. return c
  5251. }
  5252. // MaxComments sets the optional parameter "maxComments": Maximum number
  5253. // of comments to pull back on a post.
  5254. func (c *PostsGetByPathCall) MaxComments(maxComments int64) *PostsGetByPathCall {
  5255. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  5256. return c
  5257. }
  5258. // View sets the optional parameter "view": Access level with which to
  5259. // view the returned result. Note that some fields require elevated
  5260. // access.
  5261. //
  5262. // Possible values:
  5263. // "ADMIN" - Admin level detail
  5264. // "AUTHOR" - Author level detail
  5265. // "READER" - Reader level detail
  5266. func (c *PostsGetByPathCall) View(view string) *PostsGetByPathCall {
  5267. c.urlParams_.Set("view", view)
  5268. return c
  5269. }
  5270. // Fields allows partial responses to be retrieved. See
  5271. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5272. // for more information.
  5273. func (c *PostsGetByPathCall) Fields(s ...googleapi.Field) *PostsGetByPathCall {
  5274. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5275. return c
  5276. }
  5277. // IfNoneMatch sets the optional parameter which makes the operation
  5278. // fail if the object's ETag matches the given value. This is useful for
  5279. // getting updates only after the object has changed since the last
  5280. // request. Use googleapi.IsNotModified to check whether the response
  5281. // error from Do is the result of In-None-Match.
  5282. func (c *PostsGetByPathCall) IfNoneMatch(entityTag string) *PostsGetByPathCall {
  5283. c.ifNoneMatch_ = entityTag
  5284. return c
  5285. }
  5286. // Context sets the context to be used in this call's Do method. Any
  5287. // pending HTTP request will be aborted if the provided context is
  5288. // canceled.
  5289. func (c *PostsGetByPathCall) Context(ctx context.Context) *PostsGetByPathCall {
  5290. c.ctx_ = ctx
  5291. return c
  5292. }
  5293. // Header returns an http.Header that can be modified by the caller to
  5294. // add HTTP headers to the request.
  5295. func (c *PostsGetByPathCall) Header() http.Header {
  5296. if c.header_ == nil {
  5297. c.header_ = make(http.Header)
  5298. }
  5299. return c.header_
  5300. }
  5301. func (c *PostsGetByPathCall) doRequest(alt string) (*http.Response, error) {
  5302. reqHeaders := make(http.Header)
  5303. for k, v := range c.header_ {
  5304. reqHeaders[k] = v
  5305. }
  5306. reqHeaders.Set("User-Agent", c.s.userAgent())
  5307. if c.ifNoneMatch_ != "" {
  5308. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5309. }
  5310. var body io.Reader = nil
  5311. c.urlParams_.Set("alt", alt)
  5312. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/bypath")
  5313. urls += "?" + c.urlParams_.Encode()
  5314. req, _ := http.NewRequest("GET", urls, body)
  5315. req.Header = reqHeaders
  5316. googleapi.Expand(req.URL, map[string]string{
  5317. "blogId": c.blogId,
  5318. })
  5319. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5320. }
  5321. // Do executes the "blogger.posts.getByPath" call.
  5322. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5323. // code is an error. Response headers are in either
  5324. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5325. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5326. // whether the returned error was because http.StatusNotModified was
  5327. // returned.
  5328. func (c *PostsGetByPathCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5329. gensupport.SetOptions(c.urlParams_, opts...)
  5330. res, err := c.doRequest("json")
  5331. if res != nil && res.StatusCode == http.StatusNotModified {
  5332. if res.Body != nil {
  5333. res.Body.Close()
  5334. }
  5335. return nil, &googleapi.Error{
  5336. Code: res.StatusCode,
  5337. Header: res.Header,
  5338. }
  5339. }
  5340. if err != nil {
  5341. return nil, err
  5342. }
  5343. defer googleapi.CloseBody(res)
  5344. if err := googleapi.CheckResponse(res); err != nil {
  5345. return nil, err
  5346. }
  5347. ret := &Post{
  5348. ServerResponse: googleapi.ServerResponse{
  5349. Header: res.Header,
  5350. HTTPStatusCode: res.StatusCode,
  5351. },
  5352. }
  5353. target := &ret
  5354. if err := gensupport.DecodeResponse(target, res); err != nil {
  5355. return nil, err
  5356. }
  5357. return ret, nil
  5358. // {
  5359. // "description": "Retrieve a Post by Path.",
  5360. // "httpMethod": "GET",
  5361. // "id": "blogger.posts.getByPath",
  5362. // "parameterOrder": [
  5363. // "blogId",
  5364. // "path"
  5365. // ],
  5366. // "parameters": {
  5367. // "blogId": {
  5368. // "description": "ID of the blog to fetch the post from.",
  5369. // "location": "path",
  5370. // "required": true,
  5371. // "type": "string"
  5372. // },
  5373. // "maxComments": {
  5374. // "description": "Maximum number of comments to pull back on a post.",
  5375. // "format": "uint32",
  5376. // "location": "query",
  5377. // "type": "integer"
  5378. // },
  5379. // "path": {
  5380. // "description": "Path of the Post to retrieve.",
  5381. // "location": "query",
  5382. // "required": true,
  5383. // "type": "string"
  5384. // },
  5385. // "view": {
  5386. // "description": "Access level with which to view the returned result. Note that some fields require elevated access.",
  5387. // "enum": [
  5388. // "ADMIN",
  5389. // "AUTHOR",
  5390. // "READER"
  5391. // ],
  5392. // "enumDescriptions": [
  5393. // "Admin level detail",
  5394. // "Author level detail",
  5395. // "Reader level detail"
  5396. // ],
  5397. // "location": "query",
  5398. // "type": "string"
  5399. // }
  5400. // },
  5401. // "path": "blogs/{blogId}/posts/bypath",
  5402. // "response": {
  5403. // "$ref": "Post"
  5404. // },
  5405. // "scopes": [
  5406. // "https://www.googleapis.com/auth/blogger",
  5407. // "https://www.googleapis.com/auth/blogger.readonly"
  5408. // ]
  5409. // }
  5410. }
  5411. // method id "blogger.posts.insert":
  5412. type PostsInsertCall struct {
  5413. s *Service
  5414. blogId string
  5415. post *Post
  5416. urlParams_ gensupport.URLParams
  5417. ctx_ context.Context
  5418. header_ http.Header
  5419. }
  5420. // Insert: Add a post.
  5421. func (r *PostsService) Insert(blogId string, post *Post) *PostsInsertCall {
  5422. c := &PostsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5423. c.blogId = blogId
  5424. c.post = post
  5425. return c
  5426. }
  5427. // FetchBody sets the optional parameter "fetchBody": Whether the body
  5428. // content of the post is included with the result (default: true).
  5429. func (c *PostsInsertCall) FetchBody(fetchBody bool) *PostsInsertCall {
  5430. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  5431. return c
  5432. }
  5433. // FetchImages sets the optional parameter "fetchImages": Whether image
  5434. // URL metadata for each post is included in the returned result
  5435. // (default: false).
  5436. func (c *PostsInsertCall) FetchImages(fetchImages bool) *PostsInsertCall {
  5437. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  5438. return c
  5439. }
  5440. // IsDraft sets the optional parameter "isDraft": Whether to create the
  5441. // post as a draft (default: false).
  5442. func (c *PostsInsertCall) IsDraft(isDraft bool) *PostsInsertCall {
  5443. c.urlParams_.Set("isDraft", fmt.Sprint(isDraft))
  5444. return c
  5445. }
  5446. // Fields allows partial responses to be retrieved. See
  5447. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5448. // for more information.
  5449. func (c *PostsInsertCall) Fields(s ...googleapi.Field) *PostsInsertCall {
  5450. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5451. return c
  5452. }
  5453. // Context sets the context to be used in this call's Do method. Any
  5454. // pending HTTP request will be aborted if the provided context is
  5455. // canceled.
  5456. func (c *PostsInsertCall) Context(ctx context.Context) *PostsInsertCall {
  5457. c.ctx_ = ctx
  5458. return c
  5459. }
  5460. // Header returns an http.Header that can be modified by the caller to
  5461. // add HTTP headers to the request.
  5462. func (c *PostsInsertCall) Header() http.Header {
  5463. if c.header_ == nil {
  5464. c.header_ = make(http.Header)
  5465. }
  5466. return c.header_
  5467. }
  5468. func (c *PostsInsertCall) doRequest(alt string) (*http.Response, error) {
  5469. reqHeaders := make(http.Header)
  5470. for k, v := range c.header_ {
  5471. reqHeaders[k] = v
  5472. }
  5473. reqHeaders.Set("User-Agent", c.s.userAgent())
  5474. var body io.Reader = nil
  5475. body, err := googleapi.WithoutDataWrapper.JSONReader(c.post)
  5476. if err != nil {
  5477. return nil, err
  5478. }
  5479. reqHeaders.Set("Content-Type", "application/json")
  5480. c.urlParams_.Set("alt", alt)
  5481. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts")
  5482. urls += "?" + c.urlParams_.Encode()
  5483. req, _ := http.NewRequest("POST", urls, body)
  5484. req.Header = reqHeaders
  5485. googleapi.Expand(req.URL, map[string]string{
  5486. "blogId": c.blogId,
  5487. })
  5488. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5489. }
  5490. // Do executes the "blogger.posts.insert" call.
  5491. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5492. // code is an error. Response headers are in either
  5493. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5494. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5495. // whether the returned error was because http.StatusNotModified was
  5496. // returned.
  5497. func (c *PostsInsertCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5498. gensupport.SetOptions(c.urlParams_, opts...)
  5499. res, err := c.doRequest("json")
  5500. if res != nil && res.StatusCode == http.StatusNotModified {
  5501. if res.Body != nil {
  5502. res.Body.Close()
  5503. }
  5504. return nil, &googleapi.Error{
  5505. Code: res.StatusCode,
  5506. Header: res.Header,
  5507. }
  5508. }
  5509. if err != nil {
  5510. return nil, err
  5511. }
  5512. defer googleapi.CloseBody(res)
  5513. if err := googleapi.CheckResponse(res); err != nil {
  5514. return nil, err
  5515. }
  5516. ret := &Post{
  5517. ServerResponse: googleapi.ServerResponse{
  5518. Header: res.Header,
  5519. HTTPStatusCode: res.StatusCode,
  5520. },
  5521. }
  5522. target := &ret
  5523. if err := gensupport.DecodeResponse(target, res); err != nil {
  5524. return nil, err
  5525. }
  5526. return ret, nil
  5527. // {
  5528. // "description": "Add a post.",
  5529. // "httpMethod": "POST",
  5530. // "id": "blogger.posts.insert",
  5531. // "parameterOrder": [
  5532. // "blogId"
  5533. // ],
  5534. // "parameters": {
  5535. // "blogId": {
  5536. // "description": "ID of the blog to add the post to.",
  5537. // "location": "path",
  5538. // "required": true,
  5539. // "type": "string"
  5540. // },
  5541. // "fetchBody": {
  5542. // "default": "true",
  5543. // "description": "Whether the body content of the post is included with the result (default: true).",
  5544. // "location": "query",
  5545. // "type": "boolean"
  5546. // },
  5547. // "fetchImages": {
  5548. // "description": "Whether image URL metadata for each post is included in the returned result (default: false).",
  5549. // "location": "query",
  5550. // "type": "boolean"
  5551. // },
  5552. // "isDraft": {
  5553. // "description": "Whether to create the post as a draft (default: false).",
  5554. // "location": "query",
  5555. // "type": "boolean"
  5556. // }
  5557. // },
  5558. // "path": "blogs/{blogId}/posts",
  5559. // "request": {
  5560. // "$ref": "Post"
  5561. // },
  5562. // "response": {
  5563. // "$ref": "Post"
  5564. // },
  5565. // "scopes": [
  5566. // "https://www.googleapis.com/auth/blogger"
  5567. // ]
  5568. // }
  5569. }
  5570. // method id "blogger.posts.list":
  5571. type PostsListCall struct {
  5572. s *Service
  5573. blogId string
  5574. urlParams_ gensupport.URLParams
  5575. ifNoneMatch_ string
  5576. ctx_ context.Context
  5577. header_ http.Header
  5578. }
  5579. // List: Retrieves a list of posts, possibly filtered.
  5580. func (r *PostsService) List(blogId string) *PostsListCall {
  5581. c := &PostsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5582. c.blogId = blogId
  5583. return c
  5584. }
  5585. // EndDate sets the optional parameter "endDate": Latest post date to
  5586. // fetch, a date-time with RFC 3339 formatting.
  5587. func (c *PostsListCall) EndDate(endDate string) *PostsListCall {
  5588. c.urlParams_.Set("endDate", endDate)
  5589. return c
  5590. }
  5591. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  5592. // body content of posts is included (default: true). This should be set
  5593. // to false when the post bodies are not required, to help minimize
  5594. // traffic.
  5595. func (c *PostsListCall) FetchBodies(fetchBodies bool) *PostsListCall {
  5596. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  5597. return c
  5598. }
  5599. // FetchImages sets the optional parameter "fetchImages": Whether image
  5600. // URL metadata for each post is included.
  5601. func (c *PostsListCall) FetchImages(fetchImages bool) *PostsListCall {
  5602. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  5603. return c
  5604. }
  5605. // Labels sets the optional parameter "labels": Comma-separated list of
  5606. // labels to search for.
  5607. func (c *PostsListCall) Labels(labels string) *PostsListCall {
  5608. c.urlParams_.Set("labels", labels)
  5609. return c
  5610. }
  5611. // MaxResults sets the optional parameter "maxResults": Maximum number
  5612. // of posts to fetch.
  5613. func (c *PostsListCall) MaxResults(maxResults int64) *PostsListCall {
  5614. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5615. return c
  5616. }
  5617. // OrderBy sets the optional parameter "orderBy": Sort search results
  5618. //
  5619. // Possible values:
  5620. // "published" - Order by the date the post was published
  5621. // "updated" - Order by the date the post was last updated
  5622. func (c *PostsListCall) OrderBy(orderBy string) *PostsListCall {
  5623. c.urlParams_.Set("orderBy", orderBy)
  5624. return c
  5625. }
  5626. // PageToken sets the optional parameter "pageToken": Continuation token
  5627. // if the request is paged.
  5628. func (c *PostsListCall) PageToken(pageToken string) *PostsListCall {
  5629. c.urlParams_.Set("pageToken", pageToken)
  5630. return c
  5631. }
  5632. // StartDate sets the optional parameter "startDate": Earliest post date
  5633. // to fetch, a date-time with RFC 3339 formatting.
  5634. func (c *PostsListCall) StartDate(startDate string) *PostsListCall {
  5635. c.urlParams_.Set("startDate", startDate)
  5636. return c
  5637. }
  5638. // Status sets the optional parameter "status": Statuses to include in
  5639. // the results.
  5640. //
  5641. // Possible values:
  5642. // "draft" - Draft (non-published) posts.
  5643. // "live" - Published posts
  5644. // "scheduled" - Posts that are scheduled to publish in the future.
  5645. func (c *PostsListCall) Status(status ...string) *PostsListCall {
  5646. c.urlParams_.SetMulti("status", append([]string{}, status...))
  5647. return c
  5648. }
  5649. // View sets the optional parameter "view": Access level with which to
  5650. // view the returned result. Note that some fields require escalated
  5651. // access.
  5652. //
  5653. // Possible values:
  5654. // "ADMIN" - Admin level detail
  5655. // "AUTHOR" - Author level detail
  5656. // "READER" - Reader level detail
  5657. func (c *PostsListCall) View(view string) *PostsListCall {
  5658. c.urlParams_.Set("view", view)
  5659. return c
  5660. }
  5661. // Fields allows partial responses to be retrieved. See
  5662. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5663. // for more information.
  5664. func (c *PostsListCall) Fields(s ...googleapi.Field) *PostsListCall {
  5665. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5666. return c
  5667. }
  5668. // IfNoneMatch sets the optional parameter which makes the operation
  5669. // fail if the object's ETag matches the given value. This is useful for
  5670. // getting updates only after the object has changed since the last
  5671. // request. Use googleapi.IsNotModified to check whether the response
  5672. // error from Do is the result of In-None-Match.
  5673. func (c *PostsListCall) IfNoneMatch(entityTag string) *PostsListCall {
  5674. c.ifNoneMatch_ = entityTag
  5675. return c
  5676. }
  5677. // Context sets the context to be used in this call's Do method. Any
  5678. // pending HTTP request will be aborted if the provided context is
  5679. // canceled.
  5680. func (c *PostsListCall) Context(ctx context.Context) *PostsListCall {
  5681. c.ctx_ = ctx
  5682. return c
  5683. }
  5684. // Header returns an http.Header that can be modified by the caller to
  5685. // add HTTP headers to the request.
  5686. func (c *PostsListCall) Header() http.Header {
  5687. if c.header_ == nil {
  5688. c.header_ = make(http.Header)
  5689. }
  5690. return c.header_
  5691. }
  5692. func (c *PostsListCall) doRequest(alt string) (*http.Response, error) {
  5693. reqHeaders := make(http.Header)
  5694. for k, v := range c.header_ {
  5695. reqHeaders[k] = v
  5696. }
  5697. reqHeaders.Set("User-Agent", c.s.userAgent())
  5698. if c.ifNoneMatch_ != "" {
  5699. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5700. }
  5701. var body io.Reader = nil
  5702. c.urlParams_.Set("alt", alt)
  5703. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts")
  5704. urls += "?" + c.urlParams_.Encode()
  5705. req, _ := http.NewRequest("GET", urls, body)
  5706. req.Header = reqHeaders
  5707. googleapi.Expand(req.URL, map[string]string{
  5708. "blogId": c.blogId,
  5709. })
  5710. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5711. }
  5712. // Do executes the "blogger.posts.list" call.
  5713. // Exactly one of *PostList or error will be non-nil. Any non-2xx status
  5714. // code is an error. Response headers are in either
  5715. // *PostList.ServerResponse.Header or (if a response was returned at
  5716. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5717. // to check whether the returned error was because
  5718. // http.StatusNotModified was returned.
  5719. func (c *PostsListCall) Do(opts ...googleapi.CallOption) (*PostList, error) {
  5720. gensupport.SetOptions(c.urlParams_, opts...)
  5721. res, err := c.doRequest("json")
  5722. if res != nil && res.StatusCode == http.StatusNotModified {
  5723. if res.Body != nil {
  5724. res.Body.Close()
  5725. }
  5726. return nil, &googleapi.Error{
  5727. Code: res.StatusCode,
  5728. Header: res.Header,
  5729. }
  5730. }
  5731. if err != nil {
  5732. return nil, err
  5733. }
  5734. defer googleapi.CloseBody(res)
  5735. if err := googleapi.CheckResponse(res); err != nil {
  5736. return nil, err
  5737. }
  5738. ret := &PostList{
  5739. ServerResponse: googleapi.ServerResponse{
  5740. Header: res.Header,
  5741. HTTPStatusCode: res.StatusCode,
  5742. },
  5743. }
  5744. target := &ret
  5745. if err := gensupport.DecodeResponse(target, res); err != nil {
  5746. return nil, err
  5747. }
  5748. return ret, nil
  5749. // {
  5750. // "description": "Retrieves a list of posts, possibly filtered.",
  5751. // "httpMethod": "GET",
  5752. // "id": "blogger.posts.list",
  5753. // "parameterOrder": [
  5754. // "blogId"
  5755. // ],
  5756. // "parameters": {
  5757. // "blogId": {
  5758. // "description": "ID of the blog to fetch posts from.",
  5759. // "location": "path",
  5760. // "required": true,
  5761. // "type": "string"
  5762. // },
  5763. // "endDate": {
  5764. // "description": "Latest post date to fetch, a date-time with RFC 3339 formatting.",
  5765. // "format": "date-time",
  5766. // "location": "query",
  5767. // "type": "string"
  5768. // },
  5769. // "fetchBodies": {
  5770. // "default": "true",
  5771. // "description": "Whether the body content of posts is included (default: true). This should be set to false when the post bodies are not required, to help minimize traffic.",
  5772. // "location": "query",
  5773. // "type": "boolean"
  5774. // },
  5775. // "fetchImages": {
  5776. // "description": "Whether image URL metadata for each post is included.",
  5777. // "location": "query",
  5778. // "type": "boolean"
  5779. // },
  5780. // "labels": {
  5781. // "description": "Comma-separated list of labels to search for.",
  5782. // "location": "query",
  5783. // "type": "string"
  5784. // },
  5785. // "maxResults": {
  5786. // "description": "Maximum number of posts to fetch.",
  5787. // "format": "uint32",
  5788. // "location": "query",
  5789. // "type": "integer"
  5790. // },
  5791. // "orderBy": {
  5792. // "default": "PUBLISHED",
  5793. // "description": "Sort search results",
  5794. // "enum": [
  5795. // "published",
  5796. // "updated"
  5797. // ],
  5798. // "enumDescriptions": [
  5799. // "Order by the date the post was published",
  5800. // "Order by the date the post was last updated"
  5801. // ],
  5802. // "location": "query",
  5803. // "type": "string"
  5804. // },
  5805. // "pageToken": {
  5806. // "description": "Continuation token if the request is paged.",
  5807. // "location": "query",
  5808. // "type": "string"
  5809. // },
  5810. // "startDate": {
  5811. // "description": "Earliest post date to fetch, a date-time with RFC 3339 formatting.",
  5812. // "format": "date-time",
  5813. // "location": "query",
  5814. // "type": "string"
  5815. // },
  5816. // "status": {
  5817. // "description": "Statuses to include in the results.",
  5818. // "enum": [
  5819. // "draft",
  5820. // "live",
  5821. // "scheduled"
  5822. // ],
  5823. // "enumDescriptions": [
  5824. // "Draft (non-published) posts.",
  5825. // "Published posts",
  5826. // "Posts that are scheduled to publish in the future."
  5827. // ],
  5828. // "location": "query",
  5829. // "repeated": true,
  5830. // "type": "string"
  5831. // },
  5832. // "view": {
  5833. // "description": "Access level with which to view the returned result. Note that some fields require escalated access.",
  5834. // "enum": [
  5835. // "ADMIN",
  5836. // "AUTHOR",
  5837. // "READER"
  5838. // ],
  5839. // "enumDescriptions": [
  5840. // "Admin level detail",
  5841. // "Author level detail",
  5842. // "Reader level detail"
  5843. // ],
  5844. // "location": "query",
  5845. // "type": "string"
  5846. // }
  5847. // },
  5848. // "path": "blogs/{blogId}/posts",
  5849. // "response": {
  5850. // "$ref": "PostList"
  5851. // },
  5852. // "scopes": [
  5853. // "https://www.googleapis.com/auth/blogger",
  5854. // "https://www.googleapis.com/auth/blogger.readonly"
  5855. // ]
  5856. // }
  5857. }
  5858. // Pages invokes f for each page of results.
  5859. // A non-nil error returned from f will halt the iteration.
  5860. // The provided context supersedes any context provided to the Context method.
  5861. func (c *PostsListCall) Pages(ctx context.Context, f func(*PostList) error) error {
  5862. c.ctx_ = ctx
  5863. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5864. for {
  5865. x, err := c.Do()
  5866. if err != nil {
  5867. return err
  5868. }
  5869. if err := f(x); err != nil {
  5870. return err
  5871. }
  5872. if x.NextPageToken == "" {
  5873. return nil
  5874. }
  5875. c.PageToken(x.NextPageToken)
  5876. }
  5877. }
  5878. // method id "blogger.posts.patch":
  5879. type PostsPatchCall struct {
  5880. s *Service
  5881. blogId string
  5882. postId string
  5883. post *Post
  5884. urlParams_ gensupport.URLParams
  5885. ctx_ context.Context
  5886. header_ http.Header
  5887. }
  5888. // Patch: Update a post. This method supports patch semantics.
  5889. func (r *PostsService) Patch(blogId string, postId string, post *Post) *PostsPatchCall {
  5890. c := &PostsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5891. c.blogId = blogId
  5892. c.postId = postId
  5893. c.post = post
  5894. return c
  5895. }
  5896. // FetchBody sets the optional parameter "fetchBody": Whether the body
  5897. // content of the post is included with the result (default: true).
  5898. func (c *PostsPatchCall) FetchBody(fetchBody bool) *PostsPatchCall {
  5899. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  5900. return c
  5901. }
  5902. // FetchImages sets the optional parameter "fetchImages": Whether image
  5903. // URL metadata for each post is included in the returned result
  5904. // (default: false).
  5905. func (c *PostsPatchCall) FetchImages(fetchImages bool) *PostsPatchCall {
  5906. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  5907. return c
  5908. }
  5909. // MaxComments sets the optional parameter "maxComments": Maximum number
  5910. // of comments to retrieve with the returned post.
  5911. func (c *PostsPatchCall) MaxComments(maxComments int64) *PostsPatchCall {
  5912. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  5913. return c
  5914. }
  5915. // Publish sets the optional parameter "publish": Whether a publish
  5916. // action should be performed when the post is updated (default: false).
  5917. func (c *PostsPatchCall) Publish(publish bool) *PostsPatchCall {
  5918. c.urlParams_.Set("publish", fmt.Sprint(publish))
  5919. return c
  5920. }
  5921. // Revert sets the optional parameter "revert": Whether a revert action
  5922. // should be performed when the post is updated (default: false).
  5923. func (c *PostsPatchCall) Revert(revert bool) *PostsPatchCall {
  5924. c.urlParams_.Set("revert", fmt.Sprint(revert))
  5925. return c
  5926. }
  5927. // Fields allows partial responses to be retrieved. See
  5928. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5929. // for more information.
  5930. func (c *PostsPatchCall) Fields(s ...googleapi.Field) *PostsPatchCall {
  5931. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5932. return c
  5933. }
  5934. // Context sets the context to be used in this call's Do method. Any
  5935. // pending HTTP request will be aborted if the provided context is
  5936. // canceled.
  5937. func (c *PostsPatchCall) Context(ctx context.Context) *PostsPatchCall {
  5938. c.ctx_ = ctx
  5939. return c
  5940. }
  5941. // Header returns an http.Header that can be modified by the caller to
  5942. // add HTTP headers to the request.
  5943. func (c *PostsPatchCall) Header() http.Header {
  5944. if c.header_ == nil {
  5945. c.header_ = make(http.Header)
  5946. }
  5947. return c.header_
  5948. }
  5949. func (c *PostsPatchCall) doRequest(alt string) (*http.Response, error) {
  5950. reqHeaders := make(http.Header)
  5951. for k, v := range c.header_ {
  5952. reqHeaders[k] = v
  5953. }
  5954. reqHeaders.Set("User-Agent", c.s.userAgent())
  5955. var body io.Reader = nil
  5956. body, err := googleapi.WithoutDataWrapper.JSONReader(c.post)
  5957. if err != nil {
  5958. return nil, err
  5959. }
  5960. reqHeaders.Set("Content-Type", "application/json")
  5961. c.urlParams_.Set("alt", alt)
  5962. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  5963. urls += "?" + c.urlParams_.Encode()
  5964. req, _ := http.NewRequest("PATCH", urls, body)
  5965. req.Header = reqHeaders
  5966. googleapi.Expand(req.URL, map[string]string{
  5967. "blogId": c.blogId,
  5968. "postId": c.postId,
  5969. })
  5970. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5971. }
  5972. // Do executes the "blogger.posts.patch" call.
  5973. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  5974. // code is an error. Response headers are in either
  5975. // *Post.ServerResponse.Header or (if a response was returned at all) in
  5976. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5977. // whether the returned error was because http.StatusNotModified was
  5978. // returned.
  5979. func (c *PostsPatchCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  5980. gensupport.SetOptions(c.urlParams_, opts...)
  5981. res, err := c.doRequest("json")
  5982. if res != nil && res.StatusCode == http.StatusNotModified {
  5983. if res.Body != nil {
  5984. res.Body.Close()
  5985. }
  5986. return nil, &googleapi.Error{
  5987. Code: res.StatusCode,
  5988. Header: res.Header,
  5989. }
  5990. }
  5991. if err != nil {
  5992. return nil, err
  5993. }
  5994. defer googleapi.CloseBody(res)
  5995. if err := googleapi.CheckResponse(res); err != nil {
  5996. return nil, err
  5997. }
  5998. ret := &Post{
  5999. ServerResponse: googleapi.ServerResponse{
  6000. Header: res.Header,
  6001. HTTPStatusCode: res.StatusCode,
  6002. },
  6003. }
  6004. target := &ret
  6005. if err := gensupport.DecodeResponse(target, res); err != nil {
  6006. return nil, err
  6007. }
  6008. return ret, nil
  6009. // {
  6010. // "description": "Update a post. This method supports patch semantics.",
  6011. // "httpMethod": "PATCH",
  6012. // "id": "blogger.posts.patch",
  6013. // "parameterOrder": [
  6014. // "blogId",
  6015. // "postId"
  6016. // ],
  6017. // "parameters": {
  6018. // "blogId": {
  6019. // "description": "The ID of the Blog.",
  6020. // "location": "path",
  6021. // "required": true,
  6022. // "type": "string"
  6023. // },
  6024. // "fetchBody": {
  6025. // "default": "true",
  6026. // "description": "Whether the body content of the post is included with the result (default: true).",
  6027. // "location": "query",
  6028. // "type": "boolean"
  6029. // },
  6030. // "fetchImages": {
  6031. // "description": "Whether image URL metadata for each post is included in the returned result (default: false).",
  6032. // "location": "query",
  6033. // "type": "boolean"
  6034. // },
  6035. // "maxComments": {
  6036. // "description": "Maximum number of comments to retrieve with the returned post.",
  6037. // "format": "uint32",
  6038. // "location": "query",
  6039. // "type": "integer"
  6040. // },
  6041. // "postId": {
  6042. // "description": "The ID of the Post.",
  6043. // "location": "path",
  6044. // "required": true,
  6045. // "type": "string"
  6046. // },
  6047. // "publish": {
  6048. // "description": "Whether a publish action should be performed when the post is updated (default: false).",
  6049. // "location": "query",
  6050. // "type": "boolean"
  6051. // },
  6052. // "revert": {
  6053. // "description": "Whether a revert action should be performed when the post is updated (default: false).",
  6054. // "location": "query",
  6055. // "type": "boolean"
  6056. // }
  6057. // },
  6058. // "path": "blogs/{blogId}/posts/{postId}",
  6059. // "request": {
  6060. // "$ref": "Post"
  6061. // },
  6062. // "response": {
  6063. // "$ref": "Post"
  6064. // },
  6065. // "scopes": [
  6066. // "https://www.googleapis.com/auth/blogger"
  6067. // ]
  6068. // }
  6069. }
  6070. // method id "blogger.posts.publish":
  6071. type PostsPublishCall struct {
  6072. s *Service
  6073. blogId string
  6074. postId string
  6075. urlParams_ gensupport.URLParams
  6076. ctx_ context.Context
  6077. header_ http.Header
  6078. }
  6079. // Publish: Publishes a draft post, optionally at the specific time of
  6080. // the given publishDate parameter.
  6081. func (r *PostsService) Publish(blogId string, postId string) *PostsPublishCall {
  6082. c := &PostsPublishCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6083. c.blogId = blogId
  6084. c.postId = postId
  6085. return c
  6086. }
  6087. // PublishDate sets the optional parameter "publishDate": Optional date
  6088. // and time to schedule the publishing of the Blog. If no publishDate
  6089. // parameter is given, the post is either published at the a previously
  6090. // saved schedule date (if present), or the current time. If a future
  6091. // date is given, the post will be scheduled to be published.
  6092. func (c *PostsPublishCall) PublishDate(publishDate string) *PostsPublishCall {
  6093. c.urlParams_.Set("publishDate", publishDate)
  6094. return c
  6095. }
  6096. // Fields allows partial responses to be retrieved. See
  6097. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6098. // for more information.
  6099. func (c *PostsPublishCall) Fields(s ...googleapi.Field) *PostsPublishCall {
  6100. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6101. return c
  6102. }
  6103. // Context sets the context to be used in this call's Do method. Any
  6104. // pending HTTP request will be aborted if the provided context is
  6105. // canceled.
  6106. func (c *PostsPublishCall) Context(ctx context.Context) *PostsPublishCall {
  6107. c.ctx_ = ctx
  6108. return c
  6109. }
  6110. // Header returns an http.Header that can be modified by the caller to
  6111. // add HTTP headers to the request.
  6112. func (c *PostsPublishCall) Header() http.Header {
  6113. if c.header_ == nil {
  6114. c.header_ = make(http.Header)
  6115. }
  6116. return c.header_
  6117. }
  6118. func (c *PostsPublishCall) doRequest(alt string) (*http.Response, error) {
  6119. reqHeaders := make(http.Header)
  6120. for k, v := range c.header_ {
  6121. reqHeaders[k] = v
  6122. }
  6123. reqHeaders.Set("User-Agent", c.s.userAgent())
  6124. var body io.Reader = nil
  6125. c.urlParams_.Set("alt", alt)
  6126. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/publish")
  6127. urls += "?" + c.urlParams_.Encode()
  6128. req, _ := http.NewRequest("POST", urls, body)
  6129. req.Header = reqHeaders
  6130. googleapi.Expand(req.URL, map[string]string{
  6131. "blogId": c.blogId,
  6132. "postId": c.postId,
  6133. })
  6134. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6135. }
  6136. // Do executes the "blogger.posts.publish" call.
  6137. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  6138. // code is an error. Response headers are in either
  6139. // *Post.ServerResponse.Header or (if a response was returned at all) in
  6140. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6141. // whether the returned error was because http.StatusNotModified was
  6142. // returned.
  6143. func (c *PostsPublishCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  6144. gensupport.SetOptions(c.urlParams_, opts...)
  6145. res, err := c.doRequest("json")
  6146. if res != nil && res.StatusCode == http.StatusNotModified {
  6147. if res.Body != nil {
  6148. res.Body.Close()
  6149. }
  6150. return nil, &googleapi.Error{
  6151. Code: res.StatusCode,
  6152. Header: res.Header,
  6153. }
  6154. }
  6155. if err != nil {
  6156. return nil, err
  6157. }
  6158. defer googleapi.CloseBody(res)
  6159. if err := googleapi.CheckResponse(res); err != nil {
  6160. return nil, err
  6161. }
  6162. ret := &Post{
  6163. ServerResponse: googleapi.ServerResponse{
  6164. Header: res.Header,
  6165. HTTPStatusCode: res.StatusCode,
  6166. },
  6167. }
  6168. target := &ret
  6169. if err := gensupport.DecodeResponse(target, res); err != nil {
  6170. return nil, err
  6171. }
  6172. return ret, nil
  6173. // {
  6174. // "description": "Publishes a draft post, optionally at the specific time of the given publishDate parameter.",
  6175. // "httpMethod": "POST",
  6176. // "id": "blogger.posts.publish",
  6177. // "parameterOrder": [
  6178. // "blogId",
  6179. // "postId"
  6180. // ],
  6181. // "parameters": {
  6182. // "blogId": {
  6183. // "description": "The ID of the Blog.",
  6184. // "location": "path",
  6185. // "required": true,
  6186. // "type": "string"
  6187. // },
  6188. // "postId": {
  6189. // "description": "The ID of the Post.",
  6190. // "location": "path",
  6191. // "required": true,
  6192. // "type": "string"
  6193. // },
  6194. // "publishDate": {
  6195. // "description": "Optional date and time to schedule the publishing of the Blog. If no publishDate parameter is given, the post is either published at the a previously saved schedule date (if present), or the current time. If a future date is given, the post will be scheduled to be published.",
  6196. // "format": "date-time",
  6197. // "location": "query",
  6198. // "type": "string"
  6199. // }
  6200. // },
  6201. // "path": "blogs/{blogId}/posts/{postId}/publish",
  6202. // "response": {
  6203. // "$ref": "Post"
  6204. // },
  6205. // "scopes": [
  6206. // "https://www.googleapis.com/auth/blogger"
  6207. // ]
  6208. // }
  6209. }
  6210. // method id "blogger.posts.revert":
  6211. type PostsRevertCall struct {
  6212. s *Service
  6213. blogId string
  6214. postId string
  6215. urlParams_ gensupport.URLParams
  6216. ctx_ context.Context
  6217. header_ http.Header
  6218. }
  6219. // Revert: Revert a published or scheduled post to draft state.
  6220. func (r *PostsService) Revert(blogId string, postId string) *PostsRevertCall {
  6221. c := &PostsRevertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6222. c.blogId = blogId
  6223. c.postId = postId
  6224. return c
  6225. }
  6226. // Fields allows partial responses to be retrieved. See
  6227. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6228. // for more information.
  6229. func (c *PostsRevertCall) Fields(s ...googleapi.Field) *PostsRevertCall {
  6230. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6231. return c
  6232. }
  6233. // Context sets the context to be used in this call's Do method. Any
  6234. // pending HTTP request will be aborted if the provided context is
  6235. // canceled.
  6236. func (c *PostsRevertCall) Context(ctx context.Context) *PostsRevertCall {
  6237. c.ctx_ = ctx
  6238. return c
  6239. }
  6240. // Header returns an http.Header that can be modified by the caller to
  6241. // add HTTP headers to the request.
  6242. func (c *PostsRevertCall) Header() http.Header {
  6243. if c.header_ == nil {
  6244. c.header_ = make(http.Header)
  6245. }
  6246. return c.header_
  6247. }
  6248. func (c *PostsRevertCall) doRequest(alt string) (*http.Response, error) {
  6249. reqHeaders := make(http.Header)
  6250. for k, v := range c.header_ {
  6251. reqHeaders[k] = v
  6252. }
  6253. reqHeaders.Set("User-Agent", c.s.userAgent())
  6254. var body io.Reader = nil
  6255. c.urlParams_.Set("alt", alt)
  6256. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}/revert")
  6257. urls += "?" + c.urlParams_.Encode()
  6258. req, _ := http.NewRequest("POST", urls, body)
  6259. req.Header = reqHeaders
  6260. googleapi.Expand(req.URL, map[string]string{
  6261. "blogId": c.blogId,
  6262. "postId": c.postId,
  6263. })
  6264. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6265. }
  6266. // Do executes the "blogger.posts.revert" call.
  6267. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  6268. // code is an error. Response headers are in either
  6269. // *Post.ServerResponse.Header or (if a response was returned at all) in
  6270. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6271. // whether the returned error was because http.StatusNotModified was
  6272. // returned.
  6273. func (c *PostsRevertCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  6274. gensupport.SetOptions(c.urlParams_, opts...)
  6275. res, err := c.doRequest("json")
  6276. if res != nil && res.StatusCode == http.StatusNotModified {
  6277. if res.Body != nil {
  6278. res.Body.Close()
  6279. }
  6280. return nil, &googleapi.Error{
  6281. Code: res.StatusCode,
  6282. Header: res.Header,
  6283. }
  6284. }
  6285. if err != nil {
  6286. return nil, err
  6287. }
  6288. defer googleapi.CloseBody(res)
  6289. if err := googleapi.CheckResponse(res); err != nil {
  6290. return nil, err
  6291. }
  6292. ret := &Post{
  6293. ServerResponse: googleapi.ServerResponse{
  6294. Header: res.Header,
  6295. HTTPStatusCode: res.StatusCode,
  6296. },
  6297. }
  6298. target := &ret
  6299. if err := gensupport.DecodeResponse(target, res); err != nil {
  6300. return nil, err
  6301. }
  6302. return ret, nil
  6303. // {
  6304. // "description": "Revert a published or scheduled post to draft state.",
  6305. // "httpMethod": "POST",
  6306. // "id": "blogger.posts.revert",
  6307. // "parameterOrder": [
  6308. // "blogId",
  6309. // "postId"
  6310. // ],
  6311. // "parameters": {
  6312. // "blogId": {
  6313. // "description": "The ID of the Blog.",
  6314. // "location": "path",
  6315. // "required": true,
  6316. // "type": "string"
  6317. // },
  6318. // "postId": {
  6319. // "description": "The ID of the Post.",
  6320. // "location": "path",
  6321. // "required": true,
  6322. // "type": "string"
  6323. // }
  6324. // },
  6325. // "path": "blogs/{blogId}/posts/{postId}/revert",
  6326. // "response": {
  6327. // "$ref": "Post"
  6328. // },
  6329. // "scopes": [
  6330. // "https://www.googleapis.com/auth/blogger"
  6331. // ]
  6332. // }
  6333. }
  6334. // method id "blogger.posts.search":
  6335. type PostsSearchCall struct {
  6336. s *Service
  6337. blogId string
  6338. urlParams_ gensupport.URLParams
  6339. ifNoneMatch_ string
  6340. ctx_ context.Context
  6341. header_ http.Header
  6342. }
  6343. // Search: Search for a post.
  6344. func (r *PostsService) Search(blogId string, q string) *PostsSearchCall {
  6345. c := &PostsSearchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6346. c.blogId = blogId
  6347. c.urlParams_.Set("q", q)
  6348. return c
  6349. }
  6350. // FetchBodies sets the optional parameter "fetchBodies": Whether the
  6351. // body content of posts is included (default: true). This should be set
  6352. // to false when the post bodies are not required, to help minimize
  6353. // traffic.
  6354. func (c *PostsSearchCall) FetchBodies(fetchBodies bool) *PostsSearchCall {
  6355. c.urlParams_.Set("fetchBodies", fmt.Sprint(fetchBodies))
  6356. return c
  6357. }
  6358. // OrderBy sets the optional parameter "orderBy": Sort search results
  6359. //
  6360. // Possible values:
  6361. // "published" - Order by the date the post was published
  6362. // "updated" - Order by the date the post was last updated
  6363. func (c *PostsSearchCall) OrderBy(orderBy string) *PostsSearchCall {
  6364. c.urlParams_.Set("orderBy", orderBy)
  6365. return c
  6366. }
  6367. // Fields allows partial responses to be retrieved. See
  6368. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6369. // for more information.
  6370. func (c *PostsSearchCall) Fields(s ...googleapi.Field) *PostsSearchCall {
  6371. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6372. return c
  6373. }
  6374. // IfNoneMatch sets the optional parameter which makes the operation
  6375. // fail if the object's ETag matches the given value. This is useful for
  6376. // getting updates only after the object has changed since the last
  6377. // request. Use googleapi.IsNotModified to check whether the response
  6378. // error from Do is the result of In-None-Match.
  6379. func (c *PostsSearchCall) IfNoneMatch(entityTag string) *PostsSearchCall {
  6380. c.ifNoneMatch_ = entityTag
  6381. return c
  6382. }
  6383. // Context sets the context to be used in this call's Do method. Any
  6384. // pending HTTP request will be aborted if the provided context is
  6385. // canceled.
  6386. func (c *PostsSearchCall) Context(ctx context.Context) *PostsSearchCall {
  6387. c.ctx_ = ctx
  6388. return c
  6389. }
  6390. // Header returns an http.Header that can be modified by the caller to
  6391. // add HTTP headers to the request.
  6392. func (c *PostsSearchCall) Header() http.Header {
  6393. if c.header_ == nil {
  6394. c.header_ = make(http.Header)
  6395. }
  6396. return c.header_
  6397. }
  6398. func (c *PostsSearchCall) doRequest(alt string) (*http.Response, error) {
  6399. reqHeaders := make(http.Header)
  6400. for k, v := range c.header_ {
  6401. reqHeaders[k] = v
  6402. }
  6403. reqHeaders.Set("User-Agent", c.s.userAgent())
  6404. if c.ifNoneMatch_ != "" {
  6405. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6406. }
  6407. var body io.Reader = nil
  6408. c.urlParams_.Set("alt", alt)
  6409. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/search")
  6410. urls += "?" + c.urlParams_.Encode()
  6411. req, _ := http.NewRequest("GET", urls, body)
  6412. req.Header = reqHeaders
  6413. googleapi.Expand(req.URL, map[string]string{
  6414. "blogId": c.blogId,
  6415. })
  6416. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6417. }
  6418. // Do executes the "blogger.posts.search" call.
  6419. // Exactly one of *PostList or error will be non-nil. Any non-2xx status
  6420. // code is an error. Response headers are in either
  6421. // *PostList.ServerResponse.Header or (if a response was returned at
  6422. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6423. // to check whether the returned error was because
  6424. // http.StatusNotModified was returned.
  6425. func (c *PostsSearchCall) Do(opts ...googleapi.CallOption) (*PostList, error) {
  6426. gensupport.SetOptions(c.urlParams_, opts...)
  6427. res, err := c.doRequest("json")
  6428. if res != nil && res.StatusCode == http.StatusNotModified {
  6429. if res.Body != nil {
  6430. res.Body.Close()
  6431. }
  6432. return nil, &googleapi.Error{
  6433. Code: res.StatusCode,
  6434. Header: res.Header,
  6435. }
  6436. }
  6437. if err != nil {
  6438. return nil, err
  6439. }
  6440. defer googleapi.CloseBody(res)
  6441. if err := googleapi.CheckResponse(res); err != nil {
  6442. return nil, err
  6443. }
  6444. ret := &PostList{
  6445. ServerResponse: googleapi.ServerResponse{
  6446. Header: res.Header,
  6447. HTTPStatusCode: res.StatusCode,
  6448. },
  6449. }
  6450. target := &ret
  6451. if err := gensupport.DecodeResponse(target, res); err != nil {
  6452. return nil, err
  6453. }
  6454. return ret, nil
  6455. // {
  6456. // "description": "Search for a post.",
  6457. // "httpMethod": "GET",
  6458. // "id": "blogger.posts.search",
  6459. // "parameterOrder": [
  6460. // "blogId",
  6461. // "q"
  6462. // ],
  6463. // "parameters": {
  6464. // "blogId": {
  6465. // "description": "ID of the blog to fetch the post from.",
  6466. // "location": "path",
  6467. // "required": true,
  6468. // "type": "string"
  6469. // },
  6470. // "fetchBodies": {
  6471. // "default": "true",
  6472. // "description": "Whether the body content of posts is included (default: true). This should be set to false when the post bodies are not required, to help minimize traffic.",
  6473. // "location": "query",
  6474. // "type": "boolean"
  6475. // },
  6476. // "orderBy": {
  6477. // "default": "PUBLISHED",
  6478. // "description": "Sort search results",
  6479. // "enum": [
  6480. // "published",
  6481. // "updated"
  6482. // ],
  6483. // "enumDescriptions": [
  6484. // "Order by the date the post was published",
  6485. // "Order by the date the post was last updated"
  6486. // ],
  6487. // "location": "query",
  6488. // "type": "string"
  6489. // },
  6490. // "q": {
  6491. // "description": "Query terms to search this blog for matching posts.",
  6492. // "location": "query",
  6493. // "required": true,
  6494. // "type": "string"
  6495. // }
  6496. // },
  6497. // "path": "blogs/{blogId}/posts/search",
  6498. // "response": {
  6499. // "$ref": "PostList"
  6500. // },
  6501. // "scopes": [
  6502. // "https://www.googleapis.com/auth/blogger",
  6503. // "https://www.googleapis.com/auth/blogger.readonly"
  6504. // ]
  6505. // }
  6506. }
  6507. // method id "blogger.posts.update":
  6508. type PostsUpdateCall struct {
  6509. s *Service
  6510. blogId string
  6511. postId string
  6512. post *Post
  6513. urlParams_ gensupport.URLParams
  6514. ctx_ context.Context
  6515. header_ http.Header
  6516. }
  6517. // Update: Update a post.
  6518. func (r *PostsService) Update(blogId string, postId string, post *Post) *PostsUpdateCall {
  6519. c := &PostsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6520. c.blogId = blogId
  6521. c.postId = postId
  6522. c.post = post
  6523. return c
  6524. }
  6525. // FetchBody sets the optional parameter "fetchBody": Whether the body
  6526. // content of the post is included with the result (default: true).
  6527. func (c *PostsUpdateCall) FetchBody(fetchBody bool) *PostsUpdateCall {
  6528. c.urlParams_.Set("fetchBody", fmt.Sprint(fetchBody))
  6529. return c
  6530. }
  6531. // FetchImages sets the optional parameter "fetchImages": Whether image
  6532. // URL metadata for each post is included in the returned result
  6533. // (default: false).
  6534. func (c *PostsUpdateCall) FetchImages(fetchImages bool) *PostsUpdateCall {
  6535. c.urlParams_.Set("fetchImages", fmt.Sprint(fetchImages))
  6536. return c
  6537. }
  6538. // MaxComments sets the optional parameter "maxComments": Maximum number
  6539. // of comments to retrieve with the returned post.
  6540. func (c *PostsUpdateCall) MaxComments(maxComments int64) *PostsUpdateCall {
  6541. c.urlParams_.Set("maxComments", fmt.Sprint(maxComments))
  6542. return c
  6543. }
  6544. // Publish sets the optional parameter "publish": Whether a publish
  6545. // action should be performed when the post is updated (default: false).
  6546. func (c *PostsUpdateCall) Publish(publish bool) *PostsUpdateCall {
  6547. c.urlParams_.Set("publish", fmt.Sprint(publish))
  6548. return c
  6549. }
  6550. // Revert sets the optional parameter "revert": Whether a revert action
  6551. // should be performed when the post is updated (default: false).
  6552. func (c *PostsUpdateCall) Revert(revert bool) *PostsUpdateCall {
  6553. c.urlParams_.Set("revert", fmt.Sprint(revert))
  6554. return c
  6555. }
  6556. // Fields allows partial responses to be retrieved. See
  6557. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6558. // for more information.
  6559. func (c *PostsUpdateCall) Fields(s ...googleapi.Field) *PostsUpdateCall {
  6560. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6561. return c
  6562. }
  6563. // Context sets the context to be used in this call's Do method. Any
  6564. // pending HTTP request will be aborted if the provided context is
  6565. // canceled.
  6566. func (c *PostsUpdateCall) Context(ctx context.Context) *PostsUpdateCall {
  6567. c.ctx_ = ctx
  6568. return c
  6569. }
  6570. // Header returns an http.Header that can be modified by the caller to
  6571. // add HTTP headers to the request.
  6572. func (c *PostsUpdateCall) Header() http.Header {
  6573. if c.header_ == nil {
  6574. c.header_ = make(http.Header)
  6575. }
  6576. return c.header_
  6577. }
  6578. func (c *PostsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6579. reqHeaders := make(http.Header)
  6580. for k, v := range c.header_ {
  6581. reqHeaders[k] = v
  6582. }
  6583. reqHeaders.Set("User-Agent", c.s.userAgent())
  6584. var body io.Reader = nil
  6585. body, err := googleapi.WithoutDataWrapper.JSONReader(c.post)
  6586. if err != nil {
  6587. return nil, err
  6588. }
  6589. reqHeaders.Set("Content-Type", "application/json")
  6590. c.urlParams_.Set("alt", alt)
  6591. urls := googleapi.ResolveRelative(c.s.BasePath, "blogs/{blogId}/posts/{postId}")
  6592. urls += "?" + c.urlParams_.Encode()
  6593. req, _ := http.NewRequest("PUT", urls, body)
  6594. req.Header = reqHeaders
  6595. googleapi.Expand(req.URL, map[string]string{
  6596. "blogId": c.blogId,
  6597. "postId": c.postId,
  6598. })
  6599. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6600. }
  6601. // Do executes the "blogger.posts.update" call.
  6602. // Exactly one of *Post or error will be non-nil. Any non-2xx status
  6603. // code is an error. Response headers are in either
  6604. // *Post.ServerResponse.Header or (if a response was returned at all) in
  6605. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6606. // whether the returned error was because http.StatusNotModified was
  6607. // returned.
  6608. func (c *PostsUpdateCall) Do(opts ...googleapi.CallOption) (*Post, error) {
  6609. gensupport.SetOptions(c.urlParams_, opts...)
  6610. res, err := c.doRequest("json")
  6611. if res != nil && res.StatusCode == http.StatusNotModified {
  6612. if res.Body != nil {
  6613. res.Body.Close()
  6614. }
  6615. return nil, &googleapi.Error{
  6616. Code: res.StatusCode,
  6617. Header: res.Header,
  6618. }
  6619. }
  6620. if err != nil {
  6621. return nil, err
  6622. }
  6623. defer googleapi.CloseBody(res)
  6624. if err := googleapi.CheckResponse(res); err != nil {
  6625. return nil, err
  6626. }
  6627. ret := &Post{
  6628. ServerResponse: googleapi.ServerResponse{
  6629. Header: res.Header,
  6630. HTTPStatusCode: res.StatusCode,
  6631. },
  6632. }
  6633. target := &ret
  6634. if err := gensupport.DecodeResponse(target, res); err != nil {
  6635. return nil, err
  6636. }
  6637. return ret, nil
  6638. // {
  6639. // "description": "Update a post.",
  6640. // "httpMethod": "PUT",
  6641. // "id": "blogger.posts.update",
  6642. // "parameterOrder": [
  6643. // "blogId",
  6644. // "postId"
  6645. // ],
  6646. // "parameters": {
  6647. // "blogId": {
  6648. // "description": "The ID of the Blog.",
  6649. // "location": "path",
  6650. // "required": true,
  6651. // "type": "string"
  6652. // },
  6653. // "fetchBody": {
  6654. // "default": "true",
  6655. // "description": "Whether the body content of the post is included with the result (default: true).",
  6656. // "location": "query",
  6657. // "type": "boolean"
  6658. // },
  6659. // "fetchImages": {
  6660. // "description": "Whether image URL metadata for each post is included in the returned result (default: false).",
  6661. // "location": "query",
  6662. // "type": "boolean"
  6663. // },
  6664. // "maxComments": {
  6665. // "description": "Maximum number of comments to retrieve with the returned post.",
  6666. // "format": "uint32",
  6667. // "location": "query",
  6668. // "type": "integer"
  6669. // },
  6670. // "postId": {
  6671. // "description": "The ID of the Post.",
  6672. // "location": "path",
  6673. // "required": true,
  6674. // "type": "string"
  6675. // },
  6676. // "publish": {
  6677. // "description": "Whether a publish action should be performed when the post is updated (default: false).",
  6678. // "location": "query",
  6679. // "type": "boolean"
  6680. // },
  6681. // "revert": {
  6682. // "description": "Whether a revert action should be performed when the post is updated (default: false).",
  6683. // "location": "query",
  6684. // "type": "boolean"
  6685. // }
  6686. // },
  6687. // "path": "blogs/{blogId}/posts/{postId}",
  6688. // "request": {
  6689. // "$ref": "Post"
  6690. // },
  6691. // "response": {
  6692. // "$ref": "Post"
  6693. // },
  6694. // "scopes": [
  6695. // "https://www.googleapis.com/auth/blogger"
  6696. // ]
  6697. // }
  6698. }
  6699. // method id "blogger.users.get":
  6700. type UsersGetCall struct {
  6701. s *Service
  6702. userId string
  6703. urlParams_ gensupport.URLParams
  6704. ifNoneMatch_ string
  6705. ctx_ context.Context
  6706. header_ http.Header
  6707. }
  6708. // Get: Gets one user by ID.
  6709. func (r *UsersService) Get(userId string) *UsersGetCall {
  6710. c := &UsersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6711. c.userId = userId
  6712. return c
  6713. }
  6714. // Fields allows partial responses to be retrieved. See
  6715. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6716. // for more information.
  6717. func (c *UsersGetCall) Fields(s ...googleapi.Field) *UsersGetCall {
  6718. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6719. return c
  6720. }
  6721. // IfNoneMatch sets the optional parameter which makes the operation
  6722. // fail if the object's ETag matches the given value. This is useful for
  6723. // getting updates only after the object has changed since the last
  6724. // request. Use googleapi.IsNotModified to check whether the response
  6725. // error from Do is the result of In-None-Match.
  6726. func (c *UsersGetCall) IfNoneMatch(entityTag string) *UsersGetCall {
  6727. c.ifNoneMatch_ = entityTag
  6728. return c
  6729. }
  6730. // Context sets the context to be used in this call's Do method. Any
  6731. // pending HTTP request will be aborted if the provided context is
  6732. // canceled.
  6733. func (c *UsersGetCall) Context(ctx context.Context) *UsersGetCall {
  6734. c.ctx_ = ctx
  6735. return c
  6736. }
  6737. // Header returns an http.Header that can be modified by the caller to
  6738. // add HTTP headers to the request.
  6739. func (c *UsersGetCall) Header() http.Header {
  6740. if c.header_ == nil {
  6741. c.header_ = make(http.Header)
  6742. }
  6743. return c.header_
  6744. }
  6745. func (c *UsersGetCall) doRequest(alt string) (*http.Response, error) {
  6746. reqHeaders := make(http.Header)
  6747. for k, v := range c.header_ {
  6748. reqHeaders[k] = v
  6749. }
  6750. reqHeaders.Set("User-Agent", c.s.userAgent())
  6751. if c.ifNoneMatch_ != "" {
  6752. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6753. }
  6754. var body io.Reader = nil
  6755. c.urlParams_.Set("alt", alt)
  6756. urls := googleapi.ResolveRelative(c.s.BasePath, "users/{userId}")
  6757. urls += "?" + c.urlParams_.Encode()
  6758. req, _ := http.NewRequest("GET", urls, body)
  6759. req.Header = reqHeaders
  6760. googleapi.Expand(req.URL, map[string]string{
  6761. "userId": c.userId,
  6762. })
  6763. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6764. }
  6765. // Do executes the "blogger.users.get" call.
  6766. // Exactly one of *User or error will be non-nil. Any non-2xx status
  6767. // code is an error. Response headers are in either
  6768. // *User.ServerResponse.Header or (if a response was returned at all) in
  6769. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6770. // whether the returned error was because http.StatusNotModified was
  6771. // returned.
  6772. func (c *UsersGetCall) Do(opts ...googleapi.CallOption) (*User, error) {
  6773. gensupport.SetOptions(c.urlParams_, opts...)
  6774. res, err := c.doRequest("json")
  6775. if res != nil && res.StatusCode == http.StatusNotModified {
  6776. if res.Body != nil {
  6777. res.Body.Close()
  6778. }
  6779. return nil, &googleapi.Error{
  6780. Code: res.StatusCode,
  6781. Header: res.Header,
  6782. }
  6783. }
  6784. if err != nil {
  6785. return nil, err
  6786. }
  6787. defer googleapi.CloseBody(res)
  6788. if err := googleapi.CheckResponse(res); err != nil {
  6789. return nil, err
  6790. }
  6791. ret := &User{
  6792. ServerResponse: googleapi.ServerResponse{
  6793. Header: res.Header,
  6794. HTTPStatusCode: res.StatusCode,
  6795. },
  6796. }
  6797. target := &ret
  6798. if err := gensupport.DecodeResponse(target, res); err != nil {
  6799. return nil, err
  6800. }
  6801. return ret, nil
  6802. // {
  6803. // "description": "Gets one user by ID.",
  6804. // "httpMethod": "GET",
  6805. // "id": "blogger.users.get",
  6806. // "parameterOrder": [
  6807. // "userId"
  6808. // ],
  6809. // "parameters": {
  6810. // "userId": {
  6811. // "description": "The ID of the user to get.",
  6812. // "location": "path",
  6813. // "required": true,
  6814. // "type": "string"
  6815. // }
  6816. // },
  6817. // "path": "users/{userId}",
  6818. // "response": {
  6819. // "$ref": "User"
  6820. // },
  6821. // "scopes": [
  6822. // "https://www.googleapis.com/auth/blogger",
  6823. // "https://www.googleapis.com/auth/blogger.readonly"
  6824. // ]
  6825. // }
  6826. }