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.
 
 
 

6737 lines
208 KiB

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