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.
 
 
 

7710 lines
240 KiB

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