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.
 
 
 

2468 lines
89 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package safebrowsing provides access to the Safe Browsing API.
  6. //
  7. // For product documentation, see: https://developers.google.com/safe-browsing/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/safebrowsing/v4"
  14. // ...
  15. // ctx := context.Background()
  16. // safebrowsingService, err := safebrowsing.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // safebrowsingService, err := safebrowsing.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // safebrowsingService, err := safebrowsing.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package safebrowsing // import "google.golang.org/api/safebrowsing/v4"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "safebrowsing:v4"
  67. const apiName = "safebrowsing"
  68. const apiVersion = "v4"
  69. const basePath = "https://safebrowsing.googleapis.com/"
  70. // NewService creates a new Service.
  71. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  72. client, endpoint, err := htransport.NewClient(ctx, opts...)
  73. if err != nil {
  74. return nil, err
  75. }
  76. s, err := New(client)
  77. if err != nil {
  78. return nil, err
  79. }
  80. if endpoint != "" {
  81. s.BasePath = endpoint
  82. }
  83. return s, nil
  84. }
  85. // New creates a new Service. It uses the provided http.Client for requests.
  86. //
  87. // Deprecated: please use NewService instead.
  88. // To provide a custom HTTP client, use option.WithHTTPClient.
  89. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  90. func New(client *http.Client) (*Service, error) {
  91. if client == nil {
  92. return nil, errors.New("client is nil")
  93. }
  94. s := &Service{client: client, BasePath: basePath}
  95. s.EncodedFullHashes = NewEncodedFullHashesService(s)
  96. s.EncodedUpdates = NewEncodedUpdatesService(s)
  97. s.FullHashes = NewFullHashesService(s)
  98. s.ThreatHits = NewThreatHitsService(s)
  99. s.ThreatListUpdates = NewThreatListUpdatesService(s)
  100. s.ThreatLists = NewThreatListsService(s)
  101. s.ThreatMatches = NewThreatMatchesService(s)
  102. return s, nil
  103. }
  104. type Service struct {
  105. client *http.Client
  106. BasePath string // API endpoint base URL
  107. UserAgent string // optional additional User-Agent fragment
  108. EncodedFullHashes *EncodedFullHashesService
  109. EncodedUpdates *EncodedUpdatesService
  110. FullHashes *FullHashesService
  111. ThreatHits *ThreatHitsService
  112. ThreatListUpdates *ThreatListUpdatesService
  113. ThreatLists *ThreatListsService
  114. ThreatMatches *ThreatMatchesService
  115. }
  116. func (s *Service) userAgent() string {
  117. if s.UserAgent == "" {
  118. return googleapi.UserAgent
  119. }
  120. return googleapi.UserAgent + " " + s.UserAgent
  121. }
  122. func NewEncodedFullHashesService(s *Service) *EncodedFullHashesService {
  123. rs := &EncodedFullHashesService{s: s}
  124. return rs
  125. }
  126. type EncodedFullHashesService struct {
  127. s *Service
  128. }
  129. func NewEncodedUpdatesService(s *Service) *EncodedUpdatesService {
  130. rs := &EncodedUpdatesService{s: s}
  131. return rs
  132. }
  133. type EncodedUpdatesService struct {
  134. s *Service
  135. }
  136. func NewFullHashesService(s *Service) *FullHashesService {
  137. rs := &FullHashesService{s: s}
  138. return rs
  139. }
  140. type FullHashesService struct {
  141. s *Service
  142. }
  143. func NewThreatHitsService(s *Service) *ThreatHitsService {
  144. rs := &ThreatHitsService{s: s}
  145. return rs
  146. }
  147. type ThreatHitsService struct {
  148. s *Service
  149. }
  150. func NewThreatListUpdatesService(s *Service) *ThreatListUpdatesService {
  151. rs := &ThreatListUpdatesService{s: s}
  152. return rs
  153. }
  154. type ThreatListUpdatesService struct {
  155. s *Service
  156. }
  157. func NewThreatListsService(s *Service) *ThreatListsService {
  158. rs := &ThreatListsService{s: s}
  159. return rs
  160. }
  161. type ThreatListsService struct {
  162. s *Service
  163. }
  164. func NewThreatMatchesService(s *Service) *ThreatMatchesService {
  165. rs := &ThreatMatchesService{s: s}
  166. return rs
  167. }
  168. type ThreatMatchesService struct {
  169. s *Service
  170. }
  171. // Checksum: The expected state of a client's local database.
  172. type Checksum struct {
  173. // Sha256: The SHA256 hash of the client state; that is, of the sorted
  174. // list of all
  175. // hashes present in the database.
  176. Sha256 string `json:"sha256,omitempty"`
  177. // ForceSendFields is a list of field names (e.g. "Sha256") to
  178. // unconditionally include in API requests. By default, fields with
  179. // empty values are omitted from API requests. However, any non-pointer,
  180. // non-interface field appearing in ForceSendFields will be sent to the
  181. // server regardless of whether the field is empty or not. This may be
  182. // used to include empty fields in Patch requests.
  183. ForceSendFields []string `json:"-"`
  184. // NullFields is a list of field names (e.g. "Sha256") to include in API
  185. // requests with the JSON null value. By default, fields with empty
  186. // values are omitted from API requests. However, any field with an
  187. // empty value appearing in NullFields will be sent to the server as
  188. // null. It is an error if a field in this list has a non-empty value.
  189. // This may be used to include null fields in Patch requests.
  190. NullFields []string `json:"-"`
  191. }
  192. func (s *Checksum) MarshalJSON() ([]byte, error) {
  193. type NoMethod Checksum
  194. raw := NoMethod(*s)
  195. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  196. }
  197. // ClientInfo: The client metadata associated with Safe Browsing API
  198. // requests.
  199. type ClientInfo struct {
  200. // ClientId: A client ID that (hopefully) uniquely identifies the client
  201. // implementation
  202. // of the Safe Browsing API.
  203. ClientId string `json:"clientId,omitempty"`
  204. // ClientVersion: The version of the client implementation.
  205. ClientVersion string `json:"clientVersion,omitempty"`
  206. // ForceSendFields is a list of field names (e.g. "ClientId") to
  207. // unconditionally include in API requests. By default, fields with
  208. // empty values are omitted from API requests. However, any non-pointer,
  209. // non-interface field appearing in ForceSendFields will be sent to the
  210. // server regardless of whether the field is empty or not. This may be
  211. // used to include empty fields in Patch requests.
  212. ForceSendFields []string `json:"-"`
  213. // NullFields is a list of field names (e.g. "ClientId") to include in
  214. // API requests with the JSON null value. By default, fields with empty
  215. // values are omitted from API requests. However, any field with an
  216. // empty value appearing in NullFields will be sent to the server as
  217. // null. It is an error if a field in this list has a non-empty value.
  218. // This may be used to include null fields in Patch requests.
  219. NullFields []string `json:"-"`
  220. }
  221. func (s *ClientInfo) MarshalJSON() ([]byte, error) {
  222. type NoMethod ClientInfo
  223. raw := NoMethod(*s)
  224. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  225. }
  226. // Constraints: The constraints for this update.
  227. type Constraints struct {
  228. // DeviceLocation: A client's physical location, expressed as a ISO
  229. // 31166-1 alpha-2
  230. // region code.
  231. DeviceLocation string `json:"deviceLocation,omitempty"`
  232. // Language: Requests the lists for a specific language. Expects ISO 639
  233. // alpha-2
  234. // format.
  235. Language string `json:"language,omitempty"`
  236. // MaxDatabaseEntries: Sets the maximum number of entries that the
  237. // client is willing to have
  238. // in the local database. This should be a power of 2 between 2**10
  239. // and
  240. // 2**20. If zero, no database size limit is set.
  241. MaxDatabaseEntries int64 `json:"maxDatabaseEntries,omitempty"`
  242. // MaxUpdateEntries: The maximum size in number of entries. The update
  243. // will not contain more
  244. // entries than this value. This should be a power of 2 between 2**10
  245. // and
  246. // 2**20. If zero, no update size limit is set.
  247. MaxUpdateEntries int64 `json:"maxUpdateEntries,omitempty"`
  248. // Region: Requests the list for a specific geographic location. If not
  249. // set the
  250. // server may pick that value based on the user's IP address. Expects
  251. // ISO
  252. // 3166-1 alpha-2 format.
  253. Region string `json:"region,omitempty"`
  254. // SupportedCompressions: The compression types supported by the client.
  255. //
  256. // Possible values:
  257. // "COMPRESSION_TYPE_UNSPECIFIED" - Unknown.
  258. // "RAW" - Raw, uncompressed data.
  259. // "RICE" - Rice-Golomb encoded data.
  260. SupportedCompressions []string `json:"supportedCompressions,omitempty"`
  261. // ForceSendFields is a list of field names (e.g. "DeviceLocation") to
  262. // unconditionally include in API requests. By default, fields with
  263. // empty values are omitted from API requests. However, any non-pointer,
  264. // non-interface field appearing in ForceSendFields will be sent to the
  265. // server regardless of whether the field is empty or not. This may be
  266. // used to include empty fields in Patch requests.
  267. ForceSendFields []string `json:"-"`
  268. // NullFields is a list of field names (e.g. "DeviceLocation") to
  269. // include in API requests with the JSON null value. By default, fields
  270. // with empty values are omitted from API requests. However, any field
  271. // with an empty value appearing in NullFields will be sent to the
  272. // server as null. It is an error if a field in this list has a
  273. // non-empty value. This may be used to include null fields in Patch
  274. // requests.
  275. NullFields []string `json:"-"`
  276. }
  277. func (s *Constraints) MarshalJSON() ([]byte, error) {
  278. type NoMethod Constraints
  279. raw := NoMethod(*s)
  280. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  281. }
  282. // Empty: A generic empty message that you can re-use to avoid defining
  283. // duplicated
  284. // empty messages in your APIs. A typical example is to use it as the
  285. // request
  286. // or the response type of an API method. For instance:
  287. //
  288. // service Foo {
  289. // rpc Bar(google.protobuf.Empty) returns
  290. // (google.protobuf.Empty);
  291. // }
  292. //
  293. // The JSON representation for `Empty` is empty JSON object `{}`.
  294. type Empty struct {
  295. // ServerResponse contains the HTTP response code and headers from the
  296. // server.
  297. googleapi.ServerResponse `json:"-"`
  298. }
  299. // FetchThreatListUpdatesRequest: Describes a Safe Browsing API update
  300. // request. Clients can request updates for
  301. // multiple lists in a single request.
  302. // NOTE: Field index 2 is unused.
  303. // NEXT: 5
  304. type FetchThreatListUpdatesRequest struct {
  305. // Client: The client metadata.
  306. Client *ClientInfo `json:"client,omitempty"`
  307. // ListUpdateRequests: The requested threat list updates.
  308. ListUpdateRequests []*ListUpdateRequest `json:"listUpdateRequests,omitempty"`
  309. // ForceSendFields is a list of field names (e.g. "Client") to
  310. // unconditionally include in API requests. By default, fields with
  311. // empty values are omitted from API requests. However, any non-pointer,
  312. // non-interface field appearing in ForceSendFields will be sent to the
  313. // server regardless of whether the field is empty or not. This may be
  314. // used to include empty fields in Patch requests.
  315. ForceSendFields []string `json:"-"`
  316. // NullFields is a list of field names (e.g. "Client") to include in API
  317. // requests with the JSON null value. By default, fields with empty
  318. // values are omitted from API requests. However, any field with an
  319. // empty value appearing in NullFields will be sent to the server as
  320. // null. It is an error if a field in this list has a non-empty value.
  321. // This may be used to include null fields in Patch requests.
  322. NullFields []string `json:"-"`
  323. }
  324. func (s *FetchThreatListUpdatesRequest) MarshalJSON() ([]byte, error) {
  325. type NoMethod FetchThreatListUpdatesRequest
  326. raw := NoMethod(*s)
  327. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  328. }
  329. type FetchThreatListUpdatesResponse struct {
  330. // ListUpdateResponses: The list updates requested by the clients.
  331. ListUpdateResponses []*ListUpdateResponse `json:"listUpdateResponses,omitempty"`
  332. // MinimumWaitDuration: The minimum duration the client must wait before
  333. // issuing any update
  334. // request. If this field is not set clients may update as soon as they
  335. // want.
  336. MinimumWaitDuration string `json:"minimumWaitDuration,omitempty"`
  337. // ServerResponse contains the HTTP response code and headers from the
  338. // server.
  339. googleapi.ServerResponse `json:"-"`
  340. // ForceSendFields is a list of field names (e.g. "ListUpdateResponses")
  341. // to unconditionally include in API requests. By default, fields with
  342. // empty values are omitted from API requests. However, any non-pointer,
  343. // non-interface field appearing in ForceSendFields will be sent to the
  344. // server regardless of whether the field is empty or not. This may be
  345. // used to include empty fields in Patch requests.
  346. ForceSendFields []string `json:"-"`
  347. // NullFields is a list of field names (e.g. "ListUpdateResponses") to
  348. // include in API requests with the JSON null value. By default, fields
  349. // with empty values are omitted from API requests. However, any field
  350. // with an empty value appearing in NullFields will be sent to the
  351. // server as null. It is an error if a field in this list has a
  352. // non-empty value. This may be used to include null fields in Patch
  353. // requests.
  354. NullFields []string `json:"-"`
  355. }
  356. func (s *FetchThreatListUpdatesResponse) MarshalJSON() ([]byte, error) {
  357. type NoMethod FetchThreatListUpdatesResponse
  358. raw := NoMethod(*s)
  359. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  360. }
  361. // FindFullHashesRequest: Request to return full hashes matched by the
  362. // provided hash prefixes.
  363. type FindFullHashesRequest struct {
  364. // ApiClient: Client metadata associated with callers of higher-level
  365. // APIs built on top
  366. // of the client's implementation.
  367. ApiClient *ClientInfo `json:"apiClient,omitempty"`
  368. // Client: The client metadata.
  369. Client *ClientInfo `json:"client,omitempty"`
  370. // ClientStates: The current client states for each of the client's
  371. // local threat lists.
  372. ClientStates []string `json:"clientStates,omitempty"`
  373. // ThreatInfo: The lists and hashes to be checked.
  374. ThreatInfo *ThreatInfo `json:"threatInfo,omitempty"`
  375. // ForceSendFields is a list of field names (e.g. "ApiClient") to
  376. // unconditionally include in API requests. By default, fields with
  377. // empty values are omitted from API requests. However, any non-pointer,
  378. // non-interface field appearing in ForceSendFields will be sent to the
  379. // server regardless of whether the field is empty or not. This may be
  380. // used to include empty fields in Patch requests.
  381. ForceSendFields []string `json:"-"`
  382. // NullFields is a list of field names (e.g. "ApiClient") to include in
  383. // API requests with the JSON null value. By default, fields with empty
  384. // values are omitted from API requests. However, any field with an
  385. // empty value appearing in NullFields will be sent to the server as
  386. // null. It is an error if a field in this list has a non-empty value.
  387. // This may be used to include null fields in Patch requests.
  388. NullFields []string `json:"-"`
  389. }
  390. func (s *FindFullHashesRequest) MarshalJSON() ([]byte, error) {
  391. type NoMethod FindFullHashesRequest
  392. raw := NoMethod(*s)
  393. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  394. }
  395. type FindFullHashesResponse struct {
  396. // Matches: The full hashes that matched the requested prefixes.
  397. Matches []*ThreatMatch `json:"matches,omitempty"`
  398. // MinimumWaitDuration: The minimum duration the client must wait before
  399. // issuing any find hashes
  400. // request. If this field is not set, clients can issue a request as
  401. // soon as
  402. // they want.
  403. MinimumWaitDuration string `json:"minimumWaitDuration,omitempty"`
  404. // NegativeCacheDuration: For requested entities that did not match the
  405. // threat list, how long to
  406. // cache the response.
  407. NegativeCacheDuration string `json:"negativeCacheDuration,omitempty"`
  408. // ServerResponse contains the HTTP response code and headers from the
  409. // server.
  410. googleapi.ServerResponse `json:"-"`
  411. // ForceSendFields is a list of field names (e.g. "Matches") to
  412. // unconditionally include in API requests. By default, fields with
  413. // empty values are omitted from API requests. However, any non-pointer,
  414. // non-interface field appearing in ForceSendFields will be sent to the
  415. // server regardless of whether the field is empty or not. This may be
  416. // used to include empty fields in Patch requests.
  417. ForceSendFields []string `json:"-"`
  418. // NullFields is a list of field names (e.g. "Matches") to include in
  419. // API requests with the JSON null value. By default, fields with empty
  420. // values are omitted from API requests. However, any field with an
  421. // empty value appearing in NullFields will be sent to the server as
  422. // null. It is an error if a field in this list has a non-empty value.
  423. // This may be used to include null fields in Patch requests.
  424. NullFields []string `json:"-"`
  425. }
  426. func (s *FindFullHashesResponse) MarshalJSON() ([]byte, error) {
  427. type NoMethod FindFullHashesResponse
  428. raw := NoMethod(*s)
  429. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  430. }
  431. // FindThreatMatchesRequest: Request to check entries against lists.
  432. type FindThreatMatchesRequest struct {
  433. // Client: The client metadata.
  434. Client *ClientInfo `json:"client,omitempty"`
  435. // ThreatInfo: The lists and entries to be checked for matches.
  436. ThreatInfo *ThreatInfo `json:"threatInfo,omitempty"`
  437. // ForceSendFields is a list of field names (e.g. "Client") to
  438. // unconditionally include in API requests. By default, fields with
  439. // empty values are omitted from API requests. However, any non-pointer,
  440. // non-interface field appearing in ForceSendFields will be sent to the
  441. // server regardless of whether the field is empty or not. This may be
  442. // used to include empty fields in Patch requests.
  443. ForceSendFields []string `json:"-"`
  444. // NullFields is a list of field names (e.g. "Client") to include in API
  445. // requests with the JSON null value. By default, fields with empty
  446. // values are omitted from API requests. However, any field with an
  447. // empty value appearing in NullFields will be sent to the server as
  448. // null. It is an error if a field in this list has a non-empty value.
  449. // This may be used to include null fields in Patch requests.
  450. NullFields []string `json:"-"`
  451. }
  452. func (s *FindThreatMatchesRequest) MarshalJSON() ([]byte, error) {
  453. type NoMethod FindThreatMatchesRequest
  454. raw := NoMethod(*s)
  455. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  456. }
  457. type FindThreatMatchesResponse struct {
  458. // Matches: The threat list matches.
  459. Matches []*ThreatMatch `json:"matches,omitempty"`
  460. // ServerResponse contains the HTTP response code and headers from the
  461. // server.
  462. googleapi.ServerResponse `json:"-"`
  463. // ForceSendFields is a list of field names (e.g. "Matches") to
  464. // unconditionally include in API requests. By default, fields with
  465. // empty values are omitted from API requests. However, any non-pointer,
  466. // non-interface field appearing in ForceSendFields will be sent to the
  467. // server regardless of whether the field is empty or not. This may be
  468. // used to include empty fields in Patch requests.
  469. ForceSendFields []string `json:"-"`
  470. // NullFields is a list of field names (e.g. "Matches") to include in
  471. // API requests with the JSON null value. By default, fields with empty
  472. // values are omitted from API requests. However, any field with an
  473. // empty value appearing in NullFields will be sent to the server as
  474. // null. It is an error if a field in this list has a non-empty value.
  475. // This may be used to include null fields in Patch requests.
  476. NullFields []string `json:"-"`
  477. }
  478. func (s *FindThreatMatchesResponse) MarshalJSON() ([]byte, error) {
  479. type NoMethod FindThreatMatchesResponse
  480. raw := NoMethod(*s)
  481. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  482. }
  483. type ListThreatListsResponse struct {
  484. // ThreatLists: The lists available for download by the client.
  485. ThreatLists []*ThreatListDescriptor `json:"threatLists,omitempty"`
  486. // ServerResponse contains the HTTP response code and headers from the
  487. // server.
  488. googleapi.ServerResponse `json:"-"`
  489. // ForceSendFields is a list of field names (e.g. "ThreatLists") to
  490. // unconditionally include in API requests. By default, fields with
  491. // empty values are omitted from API requests. However, any non-pointer,
  492. // non-interface field appearing in ForceSendFields will be sent to the
  493. // server regardless of whether the field is empty or not. This may be
  494. // used to include empty fields in Patch requests.
  495. ForceSendFields []string `json:"-"`
  496. // NullFields is a list of field names (e.g. "ThreatLists") to include
  497. // in API requests with the JSON null value. By default, fields with
  498. // empty values are omitted from API requests. However, any field with
  499. // an empty value appearing in NullFields will be sent to the server as
  500. // null. It is an error if a field in this list has a non-empty value.
  501. // This may be used to include null fields in Patch requests.
  502. NullFields []string `json:"-"`
  503. }
  504. func (s *ListThreatListsResponse) MarshalJSON() ([]byte, error) {
  505. type NoMethod ListThreatListsResponse
  506. raw := NoMethod(*s)
  507. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  508. }
  509. // ListUpdateRequest: A single list update request.
  510. type ListUpdateRequest struct {
  511. // Constraints: The constraints associated with this request.
  512. Constraints *Constraints `json:"constraints,omitempty"`
  513. // PlatformType: The type of platform at risk by entries present in the
  514. // list.
  515. //
  516. // Possible values:
  517. // "PLATFORM_TYPE_UNSPECIFIED" - Unknown platform.
  518. // "WINDOWS" - Threat posed to Windows.
  519. // "LINUX" - Threat posed to Linux.
  520. // "ANDROID" - Threat posed to Android.
  521. // "OSX" - Threat posed to OS X.
  522. // "IOS" - Threat posed to iOS.
  523. // "ANY_PLATFORM" - Threat posed to at least one of the defined
  524. // platforms.
  525. // "ALL_PLATFORMS" - Threat posed to all defined platforms.
  526. // "CHROME" - Threat posed to Chrome.
  527. PlatformType string `json:"platformType,omitempty"`
  528. // State: The current state of the client for the requested list (the
  529. // encrypted
  530. // client state that was received from the last successful list update).
  531. State string `json:"state,omitempty"`
  532. // ThreatEntryType: The types of entries present in the list.
  533. //
  534. // Possible values:
  535. // "THREAT_ENTRY_TYPE_UNSPECIFIED" - Unspecified.
  536. // "URL" - A URL.
  537. // "EXECUTABLE" - An executable program.
  538. // "IP_RANGE" - An IP range.
  539. // "CHROME_EXTENSION" - Chrome extension.
  540. // "FILENAME" - Filename.
  541. // "CERT" - CERT
  542. ThreatEntryType string `json:"threatEntryType,omitempty"`
  543. // ThreatType: The type of threat posed by entries present in the list.
  544. //
  545. // Possible values:
  546. // "THREAT_TYPE_UNSPECIFIED" - Unknown.
  547. // "MALWARE" - Malware threat type.
  548. // "SOCIAL_ENGINEERING" - Social engineering threat type.
  549. // "UNWANTED_SOFTWARE" - Unwanted software threat type.
  550. // "POTENTIALLY_HARMFUL_APPLICATION" - Potentially harmful application
  551. // threat type.
  552. // "SOCIAL_ENGINEERING_INTERNAL" - Social engineering threat type for
  553. // internal use.
  554. // "API_ABUSE" - API abuse threat type.
  555. // "MALICIOUS_BINARY" - Malicious binary threat type.
  556. // "CSD_WHITELIST" - Client side detection whitelist threat type.
  557. // "CSD_DOWNLOAD_WHITELIST" - Client side download detection whitelist
  558. // threat type.
  559. // "CLIENT_INCIDENT" - Client incident threat type.
  560. // "CLIENT_INCIDENT_WHITELIST" - Whitelist used when detecting client
  561. // incident threats.
  562. // This enum was never launched and should be re-used for the next list.
  563. // "APK_MALWARE_OFFLINE" - List used for offline APK checks in PAM.
  564. // "SUBRESOURCE_FILTER" - Patterns to be used for activating the
  565. // subresource filter. Interstitial
  566. // will not be shown for patterns from this list.
  567. // "SUSPICIOUS" - Entities that are suspected to present a threat.
  568. // "TRICK_TO_BILL" - Trick-to-bill threat list.
  569. ThreatType string `json:"threatType,omitempty"`
  570. // ForceSendFields is a list of field names (e.g. "Constraints") to
  571. // unconditionally include in API requests. By default, fields with
  572. // empty values are omitted from API requests. However, any non-pointer,
  573. // non-interface field appearing in ForceSendFields will be sent to the
  574. // server regardless of whether the field is empty or not. This may be
  575. // used to include empty fields in Patch requests.
  576. ForceSendFields []string `json:"-"`
  577. // NullFields is a list of field names (e.g. "Constraints") to include
  578. // in API requests with the JSON null value. By default, fields with
  579. // empty values are omitted from API requests. However, any field with
  580. // an empty value appearing in NullFields will be sent to the server as
  581. // null. It is an error if a field in this list has a non-empty value.
  582. // This may be used to include null fields in Patch requests.
  583. NullFields []string `json:"-"`
  584. }
  585. func (s *ListUpdateRequest) MarshalJSON() ([]byte, error) {
  586. type NoMethod ListUpdateRequest
  587. raw := NoMethod(*s)
  588. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  589. }
  590. // ListUpdateResponse: An update to an individual list.
  591. type ListUpdateResponse struct {
  592. // Additions: A set of entries to add to a local threat type's list.
  593. // Repeated to allow
  594. // for a combination of compressed and raw data to be sent in a
  595. // single
  596. // response.
  597. Additions []*ThreatEntrySet `json:"additions,omitempty"`
  598. // Checksum: The expected SHA256 hash of the client state; that is, of
  599. // the sorted list
  600. // of all hashes present in the database after applying the provided
  601. // update.
  602. // If the client state doesn't match the expected state, the client
  603. // must
  604. // disregard this update and retry later.
  605. Checksum *Checksum `json:"checksum,omitempty"`
  606. // NewClientState: The new client state, in encrypted format. Opaque to
  607. // clients.
  608. NewClientState string `json:"newClientState,omitempty"`
  609. // PlatformType: The platform type for which data is returned.
  610. //
  611. // Possible values:
  612. // "PLATFORM_TYPE_UNSPECIFIED" - Unknown platform.
  613. // "WINDOWS" - Threat posed to Windows.
  614. // "LINUX" - Threat posed to Linux.
  615. // "ANDROID" - Threat posed to Android.
  616. // "OSX" - Threat posed to OS X.
  617. // "IOS" - Threat posed to iOS.
  618. // "ANY_PLATFORM" - Threat posed to at least one of the defined
  619. // platforms.
  620. // "ALL_PLATFORMS" - Threat posed to all defined platforms.
  621. // "CHROME" - Threat posed to Chrome.
  622. PlatformType string `json:"platformType,omitempty"`
  623. // Removals: A set of entries to remove from a local threat type's list.
  624. // In practice,
  625. // this field is empty or contains exactly one ThreatEntrySet.
  626. Removals []*ThreatEntrySet `json:"removals,omitempty"`
  627. // ResponseType: The type of response. This may indicate that an action
  628. // is required by the
  629. // client when the response is received.
  630. //
  631. // Possible values:
  632. // "RESPONSE_TYPE_UNSPECIFIED" - Unknown.
  633. // "PARTIAL_UPDATE" - Partial updates are applied to the client's
  634. // existing local database.
  635. // "FULL_UPDATE" - Full updates replace the client's entire local
  636. // database. This means
  637. // that either the client was seriously out-of-date or the client
  638. // is
  639. // believed to be corrupt.
  640. ResponseType string `json:"responseType,omitempty"`
  641. // ThreatEntryType: The format of the threats.
  642. //
  643. // Possible values:
  644. // "THREAT_ENTRY_TYPE_UNSPECIFIED" - Unspecified.
  645. // "URL" - A URL.
  646. // "EXECUTABLE" - An executable program.
  647. // "IP_RANGE" - An IP range.
  648. // "CHROME_EXTENSION" - Chrome extension.
  649. // "FILENAME" - Filename.
  650. // "CERT" - CERT
  651. ThreatEntryType string `json:"threatEntryType,omitempty"`
  652. // ThreatType: The threat type for which data is returned.
  653. //
  654. // Possible values:
  655. // "THREAT_TYPE_UNSPECIFIED" - Unknown.
  656. // "MALWARE" - Malware threat type.
  657. // "SOCIAL_ENGINEERING" - Social engineering threat type.
  658. // "UNWANTED_SOFTWARE" - Unwanted software threat type.
  659. // "POTENTIALLY_HARMFUL_APPLICATION" - Potentially harmful application
  660. // threat type.
  661. // "SOCIAL_ENGINEERING_INTERNAL" - Social engineering threat type for
  662. // internal use.
  663. // "API_ABUSE" - API abuse threat type.
  664. // "MALICIOUS_BINARY" - Malicious binary threat type.
  665. // "CSD_WHITELIST" - Client side detection whitelist threat type.
  666. // "CSD_DOWNLOAD_WHITELIST" - Client side download detection whitelist
  667. // threat type.
  668. // "CLIENT_INCIDENT" - Client incident threat type.
  669. // "CLIENT_INCIDENT_WHITELIST" - Whitelist used when detecting client
  670. // incident threats.
  671. // This enum was never launched and should be re-used for the next list.
  672. // "APK_MALWARE_OFFLINE" - List used for offline APK checks in PAM.
  673. // "SUBRESOURCE_FILTER" - Patterns to be used for activating the
  674. // subresource filter. Interstitial
  675. // will not be shown for patterns from this list.
  676. // "SUSPICIOUS" - Entities that are suspected to present a threat.
  677. // "TRICK_TO_BILL" - Trick-to-bill threat list.
  678. ThreatType string `json:"threatType,omitempty"`
  679. // ForceSendFields is a list of field names (e.g. "Additions") to
  680. // unconditionally include in API requests. By default, fields with
  681. // empty values are omitted from API requests. However, any non-pointer,
  682. // non-interface field appearing in ForceSendFields will be sent to the
  683. // server regardless of whether the field is empty or not. This may be
  684. // used to include empty fields in Patch requests.
  685. ForceSendFields []string `json:"-"`
  686. // NullFields is a list of field names (e.g. "Additions") to include in
  687. // API requests with the JSON null value. By default, fields with empty
  688. // values are omitted from API requests. However, any field with an
  689. // empty value appearing in NullFields will be sent to the server as
  690. // null. It is an error if a field in this list has a non-empty value.
  691. // This may be used to include null fields in Patch requests.
  692. NullFields []string `json:"-"`
  693. }
  694. func (s *ListUpdateResponse) MarshalJSON() ([]byte, error) {
  695. type NoMethod ListUpdateResponse
  696. raw := NoMethod(*s)
  697. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  698. }
  699. // MetadataEntry: A single metadata entry.
  700. type MetadataEntry struct {
  701. // Key: The metadata entry key. For JSON requests, the key is
  702. // base64-encoded.
  703. Key string `json:"key,omitempty"`
  704. // Value: The metadata entry value. For JSON requests, the value is
  705. // base64-encoded.
  706. Value string `json:"value,omitempty"`
  707. // ForceSendFields is a list of field names (e.g. "Key") to
  708. // unconditionally include in API requests. By default, fields with
  709. // empty values are omitted from API requests. However, any non-pointer,
  710. // non-interface field appearing in ForceSendFields will be sent to the
  711. // server regardless of whether the field is empty or not. This may be
  712. // used to include empty fields in Patch requests.
  713. ForceSendFields []string `json:"-"`
  714. // NullFields is a list of field names (e.g. "Key") to include in API
  715. // requests with the JSON null value. By default, fields with empty
  716. // values are omitted from API requests. However, any field with an
  717. // empty value appearing in NullFields will be sent to the server as
  718. // null. It is an error if a field in this list has a non-empty value.
  719. // This may be used to include null fields in Patch requests.
  720. NullFields []string `json:"-"`
  721. }
  722. func (s *MetadataEntry) MarshalJSON() ([]byte, error) {
  723. type NoMethod MetadataEntry
  724. raw := NoMethod(*s)
  725. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  726. }
  727. // RawHashes: The uncompressed threat entries in hash format of a
  728. // particular prefix length.
  729. // Hashes can be anywhere from 4 to 32 bytes in size. A large majority
  730. // are 4
  731. // bytes, but some hashes are lengthened if they collide with the hash
  732. // of a
  733. // popular URL.
  734. //
  735. // Used for sending ThreatEntrySet to clients that do not support
  736. // compression,
  737. // or when sending non-4-byte hashes to clients that do support
  738. // compression.
  739. type RawHashes struct {
  740. // PrefixSize: The number of bytes for each prefix encoded below. This
  741. // field can be
  742. // anywhere from 4 (shortest prefix) to 32 (full SHA256 hash).
  743. PrefixSize int64 `json:"prefixSize,omitempty"`
  744. // RawHashes: The hashes, in binary format, concatenated into one long
  745. // string. Hashes are
  746. // sorted in lexicographic order. For JSON API users, hashes
  747. // are
  748. // base64-encoded.
  749. RawHashes string `json:"rawHashes,omitempty"`
  750. // ForceSendFields is a list of field names (e.g. "PrefixSize") to
  751. // unconditionally include in API requests. By default, fields with
  752. // empty values are omitted from API requests. However, any non-pointer,
  753. // non-interface field appearing in ForceSendFields will be sent to the
  754. // server regardless of whether the field is empty or not. This may be
  755. // used to include empty fields in Patch requests.
  756. ForceSendFields []string `json:"-"`
  757. // NullFields is a list of field names (e.g. "PrefixSize") to include in
  758. // API requests with the JSON null value. By default, fields with empty
  759. // values are omitted from API requests. However, any field with an
  760. // empty value appearing in NullFields will be sent to the server as
  761. // null. It is an error if a field in this list has a non-empty value.
  762. // This may be used to include null fields in Patch requests.
  763. NullFields []string `json:"-"`
  764. }
  765. func (s *RawHashes) MarshalJSON() ([]byte, error) {
  766. type NoMethod RawHashes
  767. raw := NoMethod(*s)
  768. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  769. }
  770. // RawIndices: A set of raw indices to remove from a local list.
  771. type RawIndices struct {
  772. // Indices: The indices to remove from a lexicographically-sorted local
  773. // list.
  774. Indices []int64 `json:"indices,omitempty"`
  775. // ForceSendFields is a list of field names (e.g. "Indices") to
  776. // unconditionally include in API requests. By default, fields with
  777. // empty values are omitted from API requests. However, any non-pointer,
  778. // non-interface field appearing in ForceSendFields will be sent to the
  779. // server regardless of whether the field is empty or not. This may be
  780. // used to include empty fields in Patch requests.
  781. ForceSendFields []string `json:"-"`
  782. // NullFields is a list of field names (e.g. "Indices") to include in
  783. // API requests with the JSON null value. By default, fields with empty
  784. // values are omitted from API requests. However, any field with an
  785. // empty value appearing in NullFields will be sent to the server as
  786. // null. It is an error if a field in this list has a non-empty value.
  787. // This may be used to include null fields in Patch requests.
  788. NullFields []string `json:"-"`
  789. }
  790. func (s *RawIndices) MarshalJSON() ([]byte, error) {
  791. type NoMethod RawIndices
  792. raw := NoMethod(*s)
  793. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  794. }
  795. // RiceDeltaEncoding: The Rice-Golomb encoded data. Used for sending
  796. // compressed 4-byte hashes or
  797. // compressed removal indices.
  798. type RiceDeltaEncoding struct {
  799. // EncodedData: The encoded deltas that are encoded using the
  800. // Golomb-Rice coder.
  801. EncodedData string `json:"encodedData,omitempty"`
  802. // FirstValue: The offset of the first entry in the encoded data, or, if
  803. // only a single
  804. // integer was encoded, that single integer's value. If the field is
  805. // empty or
  806. // missing, assume zero.
  807. FirstValue int64 `json:"firstValue,omitempty,string"`
  808. // NumEntries: The number of entries that are delta encoded in the
  809. // encoded data. If only a
  810. // single integer was encoded, this will be zero and the single value
  811. // will be
  812. // stored in `first_value`.
  813. NumEntries int64 `json:"numEntries,omitempty"`
  814. // RiceParameter: The Golomb-Rice parameter, which is a number between 2
  815. // and 28. This field
  816. // is missing (that is, zero) if `num_entries` is zero.
  817. RiceParameter int64 `json:"riceParameter,omitempty"`
  818. // ForceSendFields is a list of field names (e.g. "EncodedData") to
  819. // unconditionally include in API requests. By default, fields with
  820. // empty values are omitted from API requests. However, any non-pointer,
  821. // non-interface field appearing in ForceSendFields will be sent to the
  822. // server regardless of whether the field is empty or not. This may be
  823. // used to include empty fields in Patch requests.
  824. ForceSendFields []string `json:"-"`
  825. // NullFields is a list of field names (e.g. "EncodedData") to include
  826. // in API requests with the JSON null value. By default, fields with
  827. // empty values are omitted from API requests. However, any field with
  828. // an empty value appearing in NullFields will be sent to the server as
  829. // null. It is an error if a field in this list has a non-empty value.
  830. // This may be used to include null fields in Patch requests.
  831. NullFields []string `json:"-"`
  832. }
  833. func (s *RiceDeltaEncoding) MarshalJSON() ([]byte, error) {
  834. type NoMethod RiceDeltaEncoding
  835. raw := NoMethod(*s)
  836. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  837. }
  838. // ThreatEntry: An individual threat; for example, a malicious URL or
  839. // its hash
  840. // representation. Only one of these fields should be set.
  841. type ThreatEntry struct {
  842. // Digest: The digest of an executable in SHA256 format. The API
  843. // supports both
  844. // binary and hex digests. For JSON requests, digests are
  845. // base64-encoded.
  846. Digest string `json:"digest,omitempty"`
  847. // Hash: A hash prefix, consisting of the most significant 4-32 bytes of
  848. // a SHA256
  849. // hash. This field is in binary format. For JSON requests, hashes
  850. // are
  851. // base64-encoded.
  852. Hash string `json:"hash,omitempty"`
  853. // Url: A URL.
  854. Url string `json:"url,omitempty"`
  855. // ForceSendFields is a list of field names (e.g. "Digest") to
  856. // unconditionally include in API requests. By default, fields with
  857. // empty values are omitted from API requests. However, any non-pointer,
  858. // non-interface field appearing in ForceSendFields will be sent to the
  859. // server regardless of whether the field is empty or not. This may be
  860. // used to include empty fields in Patch requests.
  861. ForceSendFields []string `json:"-"`
  862. // NullFields is a list of field names (e.g. "Digest") to include in API
  863. // requests with the JSON null value. By default, fields with empty
  864. // values are omitted from API requests. However, any field with an
  865. // empty value appearing in NullFields will be sent to the server as
  866. // null. It is an error if a field in this list has a non-empty value.
  867. // This may be used to include null fields in Patch requests.
  868. NullFields []string `json:"-"`
  869. }
  870. func (s *ThreatEntry) MarshalJSON() ([]byte, error) {
  871. type NoMethod ThreatEntry
  872. raw := NoMethod(*s)
  873. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  874. }
  875. // ThreatEntryMetadata: The metadata associated with a specific threat
  876. // entry. The client is expected
  877. // to know the metadata key/value pairs associated with each threat
  878. // type.
  879. type ThreatEntryMetadata struct {
  880. // Entries: The metadata entries.
  881. Entries []*MetadataEntry `json:"entries,omitempty"`
  882. // ForceSendFields is a list of field names (e.g. "Entries") to
  883. // unconditionally include in API requests. By default, fields with
  884. // empty values are omitted from API requests. However, any non-pointer,
  885. // non-interface field appearing in ForceSendFields will be sent to the
  886. // server regardless of whether the field is empty or not. This may be
  887. // used to include empty fields in Patch requests.
  888. ForceSendFields []string `json:"-"`
  889. // NullFields is a list of field names (e.g. "Entries") to include in
  890. // API requests with the JSON null value. By default, fields with empty
  891. // values are omitted from API requests. However, any field with an
  892. // empty value appearing in NullFields will be sent to the server as
  893. // null. It is an error if a field in this list has a non-empty value.
  894. // This may be used to include null fields in Patch requests.
  895. NullFields []string `json:"-"`
  896. }
  897. func (s *ThreatEntryMetadata) MarshalJSON() ([]byte, error) {
  898. type NoMethod ThreatEntryMetadata
  899. raw := NoMethod(*s)
  900. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  901. }
  902. // ThreatEntrySet: A set of threats that should be added or removed from
  903. // a client's local
  904. // database.
  905. type ThreatEntrySet struct {
  906. // CompressionType: The compression type for the entries in this set.
  907. //
  908. // Possible values:
  909. // "COMPRESSION_TYPE_UNSPECIFIED" - Unknown.
  910. // "RAW" - Raw, uncompressed data.
  911. // "RICE" - Rice-Golomb encoded data.
  912. CompressionType string `json:"compressionType,omitempty"`
  913. // RawHashes: The raw SHA256-formatted entries.
  914. RawHashes *RawHashes `json:"rawHashes,omitempty"`
  915. // RawIndices: The raw removal indices for a local list.
  916. RawIndices *RawIndices `json:"rawIndices,omitempty"`
  917. // RiceHashes: The encoded 4-byte prefixes of SHA256-formatted entries,
  918. // using a
  919. // Golomb-Rice encoding. The hashes are converted to uint32, sorted
  920. // in
  921. // ascending order, then delta encoded and stored as encoded_data.
  922. RiceHashes *RiceDeltaEncoding `json:"riceHashes,omitempty"`
  923. // RiceIndices: The encoded local, lexicographically-sorted list
  924. // indices, using a
  925. // Golomb-Rice encoding. Used for sending compressed removal indices.
  926. // The
  927. // removal indices (uint32) are sorted in ascending order, then delta
  928. // encoded
  929. // and stored as encoded_data.
  930. RiceIndices *RiceDeltaEncoding `json:"riceIndices,omitempty"`
  931. // ForceSendFields is a list of field names (e.g. "CompressionType") to
  932. // unconditionally include in API requests. By default, fields with
  933. // empty values are omitted from API requests. However, any non-pointer,
  934. // non-interface field appearing in ForceSendFields will be sent to the
  935. // server regardless of whether the field is empty or not. This may be
  936. // used to include empty fields in Patch requests.
  937. ForceSendFields []string `json:"-"`
  938. // NullFields is a list of field names (e.g. "CompressionType") to
  939. // include in API requests with the JSON null value. By default, fields
  940. // with empty values are omitted from API requests. However, any field
  941. // with an empty value appearing in NullFields will be sent to the
  942. // server as null. It is an error if a field in this list has a
  943. // non-empty value. This may be used to include null fields in Patch
  944. // requests.
  945. NullFields []string `json:"-"`
  946. }
  947. func (s *ThreatEntrySet) MarshalJSON() ([]byte, error) {
  948. type NoMethod ThreatEntrySet
  949. raw := NoMethod(*s)
  950. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  951. }
  952. type ThreatHit struct {
  953. // ClientInfo: Client-reported identification.
  954. ClientInfo *ClientInfo `json:"clientInfo,omitempty"`
  955. // Entry: The threat entry responsible for the hit. Full hash should be
  956. // reported for
  957. // hash-based hits.
  958. Entry *ThreatEntry `json:"entry,omitempty"`
  959. // PlatformType: The platform type reported.
  960. //
  961. // Possible values:
  962. // "PLATFORM_TYPE_UNSPECIFIED" - Unknown platform.
  963. // "WINDOWS" - Threat posed to Windows.
  964. // "LINUX" - Threat posed to Linux.
  965. // "ANDROID" - Threat posed to Android.
  966. // "OSX" - Threat posed to OS X.
  967. // "IOS" - Threat posed to iOS.
  968. // "ANY_PLATFORM" - Threat posed to at least one of the defined
  969. // platforms.
  970. // "ALL_PLATFORMS" - Threat posed to all defined platforms.
  971. // "CHROME" - Threat posed to Chrome.
  972. PlatformType string `json:"platformType,omitempty"`
  973. // Resources: The resources related to the threat hit.
  974. Resources []*ThreatSource `json:"resources,omitempty"`
  975. // ThreatType: The threat type reported.
  976. //
  977. // Possible values:
  978. // "THREAT_TYPE_UNSPECIFIED" - Unknown.
  979. // "MALWARE" - Malware threat type.
  980. // "SOCIAL_ENGINEERING" - Social engineering threat type.
  981. // "UNWANTED_SOFTWARE" - Unwanted software threat type.
  982. // "POTENTIALLY_HARMFUL_APPLICATION" - Potentially harmful application
  983. // threat type.
  984. // "SOCIAL_ENGINEERING_INTERNAL" - Social engineering threat type for
  985. // internal use.
  986. // "API_ABUSE" - API abuse threat type.
  987. // "MALICIOUS_BINARY" - Malicious binary threat type.
  988. // "CSD_WHITELIST" - Client side detection whitelist threat type.
  989. // "CSD_DOWNLOAD_WHITELIST" - Client side download detection whitelist
  990. // threat type.
  991. // "CLIENT_INCIDENT" - Client incident threat type.
  992. // "CLIENT_INCIDENT_WHITELIST" - Whitelist used when detecting client
  993. // incident threats.
  994. // This enum was never launched and should be re-used for the next list.
  995. // "APK_MALWARE_OFFLINE" - List used for offline APK checks in PAM.
  996. // "SUBRESOURCE_FILTER" - Patterns to be used for activating the
  997. // subresource filter. Interstitial
  998. // will not be shown for patterns from this list.
  999. // "SUSPICIOUS" - Entities that are suspected to present a threat.
  1000. // "TRICK_TO_BILL" - Trick-to-bill threat list.
  1001. ThreatType string `json:"threatType,omitempty"`
  1002. // UserInfo: Details about the user that encountered the threat.
  1003. UserInfo *UserInfo `json:"userInfo,omitempty"`
  1004. // ForceSendFields is a list of field names (e.g. "ClientInfo") to
  1005. // unconditionally include in API requests. By default, fields with
  1006. // empty values are omitted from API requests. However, any non-pointer,
  1007. // non-interface field appearing in ForceSendFields will be sent to the
  1008. // server regardless of whether the field is empty or not. This may be
  1009. // used to include empty fields in Patch requests.
  1010. ForceSendFields []string `json:"-"`
  1011. // NullFields is a list of field names (e.g. "ClientInfo") to include in
  1012. // API requests with the JSON null value. By default, fields with empty
  1013. // values are omitted from API requests. However, any field with an
  1014. // empty value appearing in NullFields will be sent to the server as
  1015. // null. It is an error if a field in this list has a non-empty value.
  1016. // This may be used to include null fields in Patch requests.
  1017. NullFields []string `json:"-"`
  1018. }
  1019. func (s *ThreatHit) MarshalJSON() ([]byte, error) {
  1020. type NoMethod ThreatHit
  1021. raw := NoMethod(*s)
  1022. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1023. }
  1024. // ThreatInfo: The information regarding one or more threats that a
  1025. // client submits when
  1026. // checking for matches in threat lists.
  1027. type ThreatInfo struct {
  1028. // PlatformTypes: The platform types to be checked.
  1029. //
  1030. // Possible values:
  1031. // "PLATFORM_TYPE_UNSPECIFIED" - Unknown platform.
  1032. // "WINDOWS" - Threat posed to Windows.
  1033. // "LINUX" - Threat posed to Linux.
  1034. // "ANDROID" - Threat posed to Android.
  1035. // "OSX" - Threat posed to OS X.
  1036. // "IOS" - Threat posed to iOS.
  1037. // "ANY_PLATFORM" - Threat posed to at least one of the defined
  1038. // platforms.
  1039. // "ALL_PLATFORMS" - Threat posed to all defined platforms.
  1040. // "CHROME" - Threat posed to Chrome.
  1041. PlatformTypes []string `json:"platformTypes,omitempty"`
  1042. // ThreatEntries: The threat entries to be checked.
  1043. ThreatEntries []*ThreatEntry `json:"threatEntries,omitempty"`
  1044. // ThreatEntryTypes: The entry types to be checked.
  1045. //
  1046. // Possible values:
  1047. // "THREAT_ENTRY_TYPE_UNSPECIFIED" - Unspecified.
  1048. // "URL" - A URL.
  1049. // "EXECUTABLE" - An executable program.
  1050. // "IP_RANGE" - An IP range.
  1051. // "CHROME_EXTENSION" - Chrome extension.
  1052. // "FILENAME" - Filename.
  1053. // "CERT" - CERT
  1054. ThreatEntryTypes []string `json:"threatEntryTypes,omitempty"`
  1055. // ThreatTypes: The threat types to be checked.
  1056. //
  1057. // Possible values:
  1058. // "THREAT_TYPE_UNSPECIFIED" - Unknown.
  1059. // "MALWARE" - Malware threat type.
  1060. // "SOCIAL_ENGINEERING" - Social engineering threat type.
  1061. // "UNWANTED_SOFTWARE" - Unwanted software threat type.
  1062. // "POTENTIALLY_HARMFUL_APPLICATION" - Potentially harmful application
  1063. // threat type.
  1064. // "SOCIAL_ENGINEERING_INTERNAL" - Social engineering threat type for
  1065. // internal use.
  1066. // "API_ABUSE" - API abuse threat type.
  1067. // "MALICIOUS_BINARY" - Malicious binary threat type.
  1068. // "CSD_WHITELIST" - Client side detection whitelist threat type.
  1069. // "CSD_DOWNLOAD_WHITELIST" - Client side download detection whitelist
  1070. // threat type.
  1071. // "CLIENT_INCIDENT" - Client incident threat type.
  1072. // "CLIENT_INCIDENT_WHITELIST" - Whitelist used when detecting client
  1073. // incident threats.
  1074. // This enum was never launched and should be re-used for the next list.
  1075. // "APK_MALWARE_OFFLINE" - List used for offline APK checks in PAM.
  1076. // "SUBRESOURCE_FILTER" - Patterns to be used for activating the
  1077. // subresource filter. Interstitial
  1078. // will not be shown for patterns from this list.
  1079. // "SUSPICIOUS" - Entities that are suspected to present a threat.
  1080. // "TRICK_TO_BILL" - Trick-to-bill threat list.
  1081. ThreatTypes []string `json:"threatTypes,omitempty"`
  1082. // ForceSendFields is a list of field names (e.g. "PlatformTypes") to
  1083. // unconditionally include in API requests. By default, fields with
  1084. // empty values are omitted from API requests. However, any non-pointer,
  1085. // non-interface field appearing in ForceSendFields will be sent to the
  1086. // server regardless of whether the field is empty or not. This may be
  1087. // used to include empty fields in Patch requests.
  1088. ForceSendFields []string `json:"-"`
  1089. // NullFields is a list of field names (e.g. "PlatformTypes") to include
  1090. // in API requests with the JSON null value. By default, fields with
  1091. // empty values are omitted from API requests. However, any field with
  1092. // an empty value appearing in NullFields will be sent to the server as
  1093. // null. It is an error if a field in this list has a non-empty value.
  1094. // This may be used to include null fields in Patch requests.
  1095. NullFields []string `json:"-"`
  1096. }
  1097. func (s *ThreatInfo) MarshalJSON() ([]byte, error) {
  1098. type NoMethod ThreatInfo
  1099. raw := NoMethod(*s)
  1100. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1101. }
  1102. // ThreatListDescriptor: Describes an individual threat list. A list is
  1103. // defined by three parameters:
  1104. // the type of threat posed, the type of platform targeted by the
  1105. // threat, and
  1106. // the type of entries in the list.
  1107. type ThreatListDescriptor struct {
  1108. // PlatformType: The platform type targeted by the list's entries.
  1109. //
  1110. // Possible values:
  1111. // "PLATFORM_TYPE_UNSPECIFIED" - Unknown platform.
  1112. // "WINDOWS" - Threat posed to Windows.
  1113. // "LINUX" - Threat posed to Linux.
  1114. // "ANDROID" - Threat posed to Android.
  1115. // "OSX" - Threat posed to OS X.
  1116. // "IOS" - Threat posed to iOS.
  1117. // "ANY_PLATFORM" - Threat posed to at least one of the defined
  1118. // platforms.
  1119. // "ALL_PLATFORMS" - Threat posed to all defined platforms.
  1120. // "CHROME" - Threat posed to Chrome.
  1121. PlatformType string `json:"platformType,omitempty"`
  1122. // ThreatEntryType: The entry types contained in the list.
  1123. //
  1124. // Possible values:
  1125. // "THREAT_ENTRY_TYPE_UNSPECIFIED" - Unspecified.
  1126. // "URL" - A URL.
  1127. // "EXECUTABLE" - An executable program.
  1128. // "IP_RANGE" - An IP range.
  1129. // "CHROME_EXTENSION" - Chrome extension.
  1130. // "FILENAME" - Filename.
  1131. // "CERT" - CERT
  1132. ThreatEntryType string `json:"threatEntryType,omitempty"`
  1133. // ThreatType: The threat type posed by the list's entries.
  1134. //
  1135. // Possible values:
  1136. // "THREAT_TYPE_UNSPECIFIED" - Unknown.
  1137. // "MALWARE" - Malware threat type.
  1138. // "SOCIAL_ENGINEERING" - Social engineering threat type.
  1139. // "UNWANTED_SOFTWARE" - Unwanted software threat type.
  1140. // "POTENTIALLY_HARMFUL_APPLICATION" - Potentially harmful application
  1141. // threat type.
  1142. // "SOCIAL_ENGINEERING_INTERNAL" - Social engineering threat type for
  1143. // internal use.
  1144. // "API_ABUSE" - API abuse threat type.
  1145. // "MALICIOUS_BINARY" - Malicious binary threat type.
  1146. // "CSD_WHITELIST" - Client side detection whitelist threat type.
  1147. // "CSD_DOWNLOAD_WHITELIST" - Client side download detection whitelist
  1148. // threat type.
  1149. // "CLIENT_INCIDENT" - Client incident threat type.
  1150. // "CLIENT_INCIDENT_WHITELIST" - Whitelist used when detecting client
  1151. // incident threats.
  1152. // This enum was never launched and should be re-used for the next list.
  1153. // "APK_MALWARE_OFFLINE" - List used for offline APK checks in PAM.
  1154. // "SUBRESOURCE_FILTER" - Patterns to be used for activating the
  1155. // subresource filter. Interstitial
  1156. // will not be shown for patterns from this list.
  1157. // "SUSPICIOUS" - Entities that are suspected to present a threat.
  1158. // "TRICK_TO_BILL" - Trick-to-bill threat list.
  1159. ThreatType string `json:"threatType,omitempty"`
  1160. // ForceSendFields is a list of field names (e.g. "PlatformType") 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. "PlatformType") to include
  1168. // in API requests with the JSON null value. By default, fields with
  1169. // empty values are omitted from API requests. However, any field with
  1170. // an 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 *ThreatListDescriptor) MarshalJSON() ([]byte, error) {
  1176. type NoMethod ThreatListDescriptor
  1177. raw := NoMethod(*s)
  1178. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1179. }
  1180. // ThreatMatch: A match when checking a threat entry in the Safe
  1181. // Browsing threat lists.
  1182. type ThreatMatch struct {
  1183. // CacheDuration: The cache lifetime for the returned match. Clients
  1184. // must not cache this
  1185. // response for more than this duration to avoid false positives.
  1186. CacheDuration string `json:"cacheDuration,omitempty"`
  1187. // PlatformType: The platform type matching this threat.
  1188. //
  1189. // Possible values:
  1190. // "PLATFORM_TYPE_UNSPECIFIED" - Unknown platform.
  1191. // "WINDOWS" - Threat posed to Windows.
  1192. // "LINUX" - Threat posed to Linux.
  1193. // "ANDROID" - Threat posed to Android.
  1194. // "OSX" - Threat posed to OS X.
  1195. // "IOS" - Threat posed to iOS.
  1196. // "ANY_PLATFORM" - Threat posed to at least one of the defined
  1197. // platforms.
  1198. // "ALL_PLATFORMS" - Threat posed to all defined platforms.
  1199. // "CHROME" - Threat posed to Chrome.
  1200. PlatformType string `json:"platformType,omitempty"`
  1201. // Threat: The threat matching this threat.
  1202. Threat *ThreatEntry `json:"threat,omitempty"`
  1203. // ThreatEntryMetadata: Optional metadata associated with this threat.
  1204. ThreatEntryMetadata *ThreatEntryMetadata `json:"threatEntryMetadata,omitempty"`
  1205. // ThreatEntryType: The threat entry type matching this threat.
  1206. //
  1207. // Possible values:
  1208. // "THREAT_ENTRY_TYPE_UNSPECIFIED" - Unspecified.
  1209. // "URL" - A URL.
  1210. // "EXECUTABLE" - An executable program.
  1211. // "IP_RANGE" - An IP range.
  1212. // "CHROME_EXTENSION" - Chrome extension.
  1213. // "FILENAME" - Filename.
  1214. // "CERT" - CERT
  1215. ThreatEntryType string `json:"threatEntryType,omitempty"`
  1216. // ThreatType: The threat type matching this threat.
  1217. //
  1218. // Possible values:
  1219. // "THREAT_TYPE_UNSPECIFIED" - Unknown.
  1220. // "MALWARE" - Malware threat type.
  1221. // "SOCIAL_ENGINEERING" - Social engineering threat type.
  1222. // "UNWANTED_SOFTWARE" - Unwanted software threat type.
  1223. // "POTENTIALLY_HARMFUL_APPLICATION" - Potentially harmful application
  1224. // threat type.
  1225. // "SOCIAL_ENGINEERING_INTERNAL" - Social engineering threat type for
  1226. // internal use.
  1227. // "API_ABUSE" - API abuse threat type.
  1228. // "MALICIOUS_BINARY" - Malicious binary threat type.
  1229. // "CSD_WHITELIST" - Client side detection whitelist threat type.
  1230. // "CSD_DOWNLOAD_WHITELIST" - Client side download detection whitelist
  1231. // threat type.
  1232. // "CLIENT_INCIDENT" - Client incident threat type.
  1233. // "CLIENT_INCIDENT_WHITELIST" - Whitelist used when detecting client
  1234. // incident threats.
  1235. // This enum was never launched and should be re-used for the next list.
  1236. // "APK_MALWARE_OFFLINE" - List used for offline APK checks in PAM.
  1237. // "SUBRESOURCE_FILTER" - Patterns to be used for activating the
  1238. // subresource filter. Interstitial
  1239. // will not be shown for patterns from this list.
  1240. // "SUSPICIOUS" - Entities that are suspected to present a threat.
  1241. // "TRICK_TO_BILL" - Trick-to-bill threat list.
  1242. ThreatType string `json:"threatType,omitempty"`
  1243. // ForceSendFields is a list of field names (e.g. "CacheDuration") to
  1244. // unconditionally include in API requests. By default, fields with
  1245. // empty values are omitted from API requests. However, any non-pointer,
  1246. // non-interface field appearing in ForceSendFields will be sent to the
  1247. // server regardless of whether the field is empty or not. This may be
  1248. // used to include empty fields in Patch requests.
  1249. ForceSendFields []string `json:"-"`
  1250. // NullFields is a list of field names (e.g. "CacheDuration") to include
  1251. // in API requests with the JSON null value. By default, fields with
  1252. // empty values are omitted from API requests. However, any field with
  1253. // an empty value appearing in NullFields will be sent to the server as
  1254. // null. It is an error if a field in this list has a non-empty value.
  1255. // This may be used to include null fields in Patch requests.
  1256. NullFields []string `json:"-"`
  1257. }
  1258. func (s *ThreatMatch) MarshalJSON() ([]byte, error) {
  1259. type NoMethod ThreatMatch
  1260. raw := NoMethod(*s)
  1261. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1262. }
  1263. // ThreatSource: A single resource related to a threat hit.
  1264. type ThreatSource struct {
  1265. // Referrer: Referrer of the resource. Only set if the referrer is
  1266. // available.
  1267. Referrer string `json:"referrer,omitempty"`
  1268. // RemoteIp: The remote IP of the resource in ASCII format. Either IPv4
  1269. // or IPv6.
  1270. RemoteIp string `json:"remoteIp,omitempty"`
  1271. // Type: The type of source reported.
  1272. //
  1273. // Possible values:
  1274. // "THREAT_SOURCE_TYPE_UNSPECIFIED" - Unknown.
  1275. // "MATCHING_URL" - The URL that matched the threat list (for which
  1276. // GetFullHash returned a
  1277. // valid hash).
  1278. // "TAB_URL" - The final top-level URL of the tab that the client was
  1279. // browsing when the
  1280. // match occurred.
  1281. // "TAB_REDIRECT" - A redirect URL that was fetched before hitting the
  1282. // final TAB_URL.
  1283. // "TAB_RESOURCE" - A resource loaded within the final TAB_URL.
  1284. Type string `json:"type,omitempty"`
  1285. // Url: The URL of the resource.
  1286. Url string `json:"url,omitempty"`
  1287. // ForceSendFields is a list of field names (e.g. "Referrer") to
  1288. // unconditionally include in API requests. By default, fields with
  1289. // empty values are omitted from API requests. However, any non-pointer,
  1290. // non-interface field appearing in ForceSendFields will be sent to the
  1291. // server regardless of whether the field is empty or not. This may be
  1292. // used to include empty fields in Patch requests.
  1293. ForceSendFields []string `json:"-"`
  1294. // NullFields is a list of field names (e.g. "Referrer") to include in
  1295. // API requests with the JSON null value. By default, fields with empty
  1296. // values are omitted from API requests. However, any field with an
  1297. // empty value appearing in NullFields will be sent to the server as
  1298. // null. It is an error if a field in this list has a non-empty value.
  1299. // This may be used to include null fields in Patch requests.
  1300. NullFields []string `json:"-"`
  1301. }
  1302. func (s *ThreatSource) MarshalJSON() ([]byte, error) {
  1303. type NoMethod ThreatSource
  1304. raw := NoMethod(*s)
  1305. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1306. }
  1307. // UserInfo: Details about the user that encountered the threat.
  1308. type UserInfo struct {
  1309. // RegionCode: The UN M.49 region code associated with the user's
  1310. // location.
  1311. RegionCode string `json:"regionCode,omitempty"`
  1312. // UserId: Unique user identifier defined by the client.
  1313. UserId string `json:"userId,omitempty"`
  1314. // ForceSendFields is a list of field names (e.g. "RegionCode") to
  1315. // unconditionally include in API requests. By default, fields with
  1316. // empty values are omitted from API requests. However, any non-pointer,
  1317. // non-interface field appearing in ForceSendFields will be sent to the
  1318. // server regardless of whether the field is empty or not. This may be
  1319. // used to include empty fields in Patch requests.
  1320. ForceSendFields []string `json:"-"`
  1321. // NullFields is a list of field names (e.g. "RegionCode") to include in
  1322. // API requests with the JSON null value. By default, fields with empty
  1323. // values are omitted from API requests. However, any field with an
  1324. // empty value appearing in NullFields will be sent to the server as
  1325. // null. It is an error if a field in this list has a non-empty value.
  1326. // This may be used to include null fields in Patch requests.
  1327. NullFields []string `json:"-"`
  1328. }
  1329. func (s *UserInfo) MarshalJSON() ([]byte, error) {
  1330. type NoMethod UserInfo
  1331. raw := NoMethod(*s)
  1332. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1333. }
  1334. // method id "safebrowsing.encodedFullHashes.get":
  1335. type EncodedFullHashesGetCall struct {
  1336. s *Service
  1337. encodedRequest string
  1338. urlParams_ gensupport.URLParams
  1339. ifNoneMatch_ string
  1340. ctx_ context.Context
  1341. header_ http.Header
  1342. }
  1343. // Get:
  1344. func (r *EncodedFullHashesService) Get(encodedRequest string) *EncodedFullHashesGetCall {
  1345. c := &EncodedFullHashesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1346. c.encodedRequest = encodedRequest
  1347. return c
  1348. }
  1349. // ClientId sets the optional parameter "clientId": A client ID that
  1350. // (hopefully) uniquely identifies the client implementation
  1351. // of the Safe Browsing API.
  1352. func (c *EncodedFullHashesGetCall) ClientId(clientId string) *EncodedFullHashesGetCall {
  1353. c.urlParams_.Set("clientId", clientId)
  1354. return c
  1355. }
  1356. // ClientVersion sets the optional parameter "clientVersion": The
  1357. // version of the client implementation.
  1358. func (c *EncodedFullHashesGetCall) ClientVersion(clientVersion string) *EncodedFullHashesGetCall {
  1359. c.urlParams_.Set("clientVersion", clientVersion)
  1360. return c
  1361. }
  1362. // Fields allows partial responses to be retrieved. See
  1363. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1364. // for more information.
  1365. func (c *EncodedFullHashesGetCall) Fields(s ...googleapi.Field) *EncodedFullHashesGetCall {
  1366. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1367. return c
  1368. }
  1369. // IfNoneMatch sets the optional parameter which makes the operation
  1370. // fail if the object's ETag matches the given value. This is useful for
  1371. // getting updates only after the object has changed since the last
  1372. // request. Use googleapi.IsNotModified to check whether the response
  1373. // error from Do is the result of In-None-Match.
  1374. func (c *EncodedFullHashesGetCall) IfNoneMatch(entityTag string) *EncodedFullHashesGetCall {
  1375. c.ifNoneMatch_ = entityTag
  1376. return c
  1377. }
  1378. // Context sets the context to be used in this call's Do method. Any
  1379. // pending HTTP request will be aborted if the provided context is
  1380. // canceled.
  1381. func (c *EncodedFullHashesGetCall) Context(ctx context.Context) *EncodedFullHashesGetCall {
  1382. c.ctx_ = ctx
  1383. return c
  1384. }
  1385. // Header returns an http.Header that can be modified by the caller to
  1386. // add HTTP headers to the request.
  1387. func (c *EncodedFullHashesGetCall) Header() http.Header {
  1388. if c.header_ == nil {
  1389. c.header_ = make(http.Header)
  1390. }
  1391. return c.header_
  1392. }
  1393. func (c *EncodedFullHashesGetCall) doRequest(alt string) (*http.Response, error) {
  1394. reqHeaders := make(http.Header)
  1395. for k, v := range c.header_ {
  1396. reqHeaders[k] = v
  1397. }
  1398. reqHeaders.Set("User-Agent", c.s.userAgent())
  1399. if c.ifNoneMatch_ != "" {
  1400. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1401. }
  1402. var body io.Reader = nil
  1403. c.urlParams_.Set("alt", alt)
  1404. c.urlParams_.Set("prettyPrint", "false")
  1405. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/encodedFullHashes/{encodedRequest}")
  1406. urls += "?" + c.urlParams_.Encode()
  1407. req, err := http.NewRequest("GET", urls, body)
  1408. if err != nil {
  1409. return nil, err
  1410. }
  1411. req.Header = reqHeaders
  1412. googleapi.Expand(req.URL, map[string]string{
  1413. "encodedRequest": c.encodedRequest,
  1414. })
  1415. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1416. }
  1417. // Do executes the "safebrowsing.encodedFullHashes.get" call.
  1418. // Exactly one of *FindFullHashesResponse or error will be non-nil. Any
  1419. // non-2xx status code is an error. Response headers are in either
  1420. // *FindFullHashesResponse.ServerResponse.Header or (if a response was
  1421. // returned at all) in error.(*googleapi.Error).Header. Use
  1422. // googleapi.IsNotModified to check whether the returned error was
  1423. // because http.StatusNotModified was returned.
  1424. func (c *EncodedFullHashesGetCall) Do(opts ...googleapi.CallOption) (*FindFullHashesResponse, error) {
  1425. gensupport.SetOptions(c.urlParams_, opts...)
  1426. res, err := c.doRequest("json")
  1427. if res != nil && res.StatusCode == http.StatusNotModified {
  1428. if res.Body != nil {
  1429. res.Body.Close()
  1430. }
  1431. return nil, &googleapi.Error{
  1432. Code: res.StatusCode,
  1433. Header: res.Header,
  1434. }
  1435. }
  1436. if err != nil {
  1437. return nil, err
  1438. }
  1439. defer googleapi.CloseBody(res)
  1440. if err := googleapi.CheckResponse(res); err != nil {
  1441. return nil, err
  1442. }
  1443. ret := &FindFullHashesResponse{
  1444. ServerResponse: googleapi.ServerResponse{
  1445. Header: res.Header,
  1446. HTTPStatusCode: res.StatusCode,
  1447. },
  1448. }
  1449. target := &ret
  1450. if err := gensupport.DecodeResponse(target, res); err != nil {
  1451. return nil, err
  1452. }
  1453. return ret, nil
  1454. // {
  1455. // "description": "",
  1456. // "flatPath": "v4/encodedFullHashes/{encodedRequest}",
  1457. // "httpMethod": "GET",
  1458. // "id": "safebrowsing.encodedFullHashes.get",
  1459. // "parameterOrder": [
  1460. // "encodedRequest"
  1461. // ],
  1462. // "parameters": {
  1463. // "clientId": {
  1464. // "description": "A client ID that (hopefully) uniquely identifies the client implementation\nof the Safe Browsing API.",
  1465. // "location": "query",
  1466. // "type": "string"
  1467. // },
  1468. // "clientVersion": {
  1469. // "description": "The version of the client implementation.",
  1470. // "location": "query",
  1471. // "type": "string"
  1472. // },
  1473. // "encodedRequest": {
  1474. // "description": "A serialized FindFullHashesRequest proto.",
  1475. // "format": "byte",
  1476. // "location": "path",
  1477. // "required": true,
  1478. // "type": "string"
  1479. // }
  1480. // },
  1481. // "path": "v4/encodedFullHashes/{encodedRequest}",
  1482. // "response": {
  1483. // "$ref": "FindFullHashesResponse"
  1484. // }
  1485. // }
  1486. }
  1487. // method id "safebrowsing.encodedUpdates.get":
  1488. type EncodedUpdatesGetCall struct {
  1489. s *Service
  1490. encodedRequest string
  1491. urlParams_ gensupport.URLParams
  1492. ifNoneMatch_ string
  1493. ctx_ context.Context
  1494. header_ http.Header
  1495. }
  1496. // Get:
  1497. func (r *EncodedUpdatesService) Get(encodedRequest string) *EncodedUpdatesGetCall {
  1498. c := &EncodedUpdatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1499. c.encodedRequest = encodedRequest
  1500. return c
  1501. }
  1502. // ClientId sets the optional parameter "clientId": A client ID that
  1503. // uniquely identifies the client implementation of the Safe
  1504. // Browsing API.
  1505. func (c *EncodedUpdatesGetCall) ClientId(clientId string) *EncodedUpdatesGetCall {
  1506. c.urlParams_.Set("clientId", clientId)
  1507. return c
  1508. }
  1509. // ClientVersion sets the optional parameter "clientVersion": The
  1510. // version of the client implementation.
  1511. func (c *EncodedUpdatesGetCall) ClientVersion(clientVersion string) *EncodedUpdatesGetCall {
  1512. c.urlParams_.Set("clientVersion", clientVersion)
  1513. return c
  1514. }
  1515. // Fields allows partial responses to be retrieved. See
  1516. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1517. // for more information.
  1518. func (c *EncodedUpdatesGetCall) Fields(s ...googleapi.Field) *EncodedUpdatesGetCall {
  1519. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1520. return c
  1521. }
  1522. // IfNoneMatch sets the optional parameter which makes the operation
  1523. // fail if the object's ETag matches the given value. This is useful for
  1524. // getting updates only after the object has changed since the last
  1525. // request. Use googleapi.IsNotModified to check whether the response
  1526. // error from Do is the result of In-None-Match.
  1527. func (c *EncodedUpdatesGetCall) IfNoneMatch(entityTag string) *EncodedUpdatesGetCall {
  1528. c.ifNoneMatch_ = entityTag
  1529. return c
  1530. }
  1531. // Context sets the context to be used in this call's Do method. Any
  1532. // pending HTTP request will be aborted if the provided context is
  1533. // canceled.
  1534. func (c *EncodedUpdatesGetCall) Context(ctx context.Context) *EncodedUpdatesGetCall {
  1535. c.ctx_ = ctx
  1536. return c
  1537. }
  1538. // Header returns an http.Header that can be modified by the caller to
  1539. // add HTTP headers to the request.
  1540. func (c *EncodedUpdatesGetCall) Header() http.Header {
  1541. if c.header_ == nil {
  1542. c.header_ = make(http.Header)
  1543. }
  1544. return c.header_
  1545. }
  1546. func (c *EncodedUpdatesGetCall) doRequest(alt string) (*http.Response, error) {
  1547. reqHeaders := make(http.Header)
  1548. for k, v := range c.header_ {
  1549. reqHeaders[k] = v
  1550. }
  1551. reqHeaders.Set("User-Agent", c.s.userAgent())
  1552. if c.ifNoneMatch_ != "" {
  1553. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1554. }
  1555. var body io.Reader = nil
  1556. c.urlParams_.Set("alt", alt)
  1557. c.urlParams_.Set("prettyPrint", "false")
  1558. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/encodedUpdates/{encodedRequest}")
  1559. urls += "?" + c.urlParams_.Encode()
  1560. req, err := http.NewRequest("GET", urls, body)
  1561. if err != nil {
  1562. return nil, err
  1563. }
  1564. req.Header = reqHeaders
  1565. googleapi.Expand(req.URL, map[string]string{
  1566. "encodedRequest": c.encodedRequest,
  1567. })
  1568. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1569. }
  1570. // Do executes the "safebrowsing.encodedUpdates.get" call.
  1571. // Exactly one of *FetchThreatListUpdatesResponse or error will be
  1572. // non-nil. Any non-2xx status code is an error. Response headers are in
  1573. // either *FetchThreatListUpdatesResponse.ServerResponse.Header or (if a
  1574. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1575. // googleapi.IsNotModified to check whether the returned error was
  1576. // because http.StatusNotModified was returned.
  1577. func (c *EncodedUpdatesGetCall) Do(opts ...googleapi.CallOption) (*FetchThreatListUpdatesResponse, error) {
  1578. gensupport.SetOptions(c.urlParams_, opts...)
  1579. res, err := c.doRequest("json")
  1580. if res != nil && res.StatusCode == http.StatusNotModified {
  1581. if res.Body != nil {
  1582. res.Body.Close()
  1583. }
  1584. return nil, &googleapi.Error{
  1585. Code: res.StatusCode,
  1586. Header: res.Header,
  1587. }
  1588. }
  1589. if err != nil {
  1590. return nil, err
  1591. }
  1592. defer googleapi.CloseBody(res)
  1593. if err := googleapi.CheckResponse(res); err != nil {
  1594. return nil, err
  1595. }
  1596. ret := &FetchThreatListUpdatesResponse{
  1597. ServerResponse: googleapi.ServerResponse{
  1598. Header: res.Header,
  1599. HTTPStatusCode: res.StatusCode,
  1600. },
  1601. }
  1602. target := &ret
  1603. if err := gensupport.DecodeResponse(target, res); err != nil {
  1604. return nil, err
  1605. }
  1606. return ret, nil
  1607. // {
  1608. // "description": "",
  1609. // "flatPath": "v4/encodedUpdates/{encodedRequest}",
  1610. // "httpMethod": "GET",
  1611. // "id": "safebrowsing.encodedUpdates.get",
  1612. // "parameterOrder": [
  1613. // "encodedRequest"
  1614. // ],
  1615. // "parameters": {
  1616. // "clientId": {
  1617. // "description": "A client ID that uniquely identifies the client implementation of the Safe\nBrowsing API.",
  1618. // "location": "query",
  1619. // "type": "string"
  1620. // },
  1621. // "clientVersion": {
  1622. // "description": "The version of the client implementation.",
  1623. // "location": "query",
  1624. // "type": "string"
  1625. // },
  1626. // "encodedRequest": {
  1627. // "description": "A serialized FetchThreatListUpdatesRequest proto.",
  1628. // "format": "byte",
  1629. // "location": "path",
  1630. // "required": true,
  1631. // "type": "string"
  1632. // }
  1633. // },
  1634. // "path": "v4/encodedUpdates/{encodedRequest}",
  1635. // "response": {
  1636. // "$ref": "FetchThreatListUpdatesResponse"
  1637. // }
  1638. // }
  1639. }
  1640. // method id "safebrowsing.fullHashes.find":
  1641. type FullHashesFindCall struct {
  1642. s *Service
  1643. findfullhashesrequest *FindFullHashesRequest
  1644. urlParams_ gensupport.URLParams
  1645. ctx_ context.Context
  1646. header_ http.Header
  1647. }
  1648. // Find: Finds the full hashes that match the requested hash prefixes.
  1649. func (r *FullHashesService) Find(findfullhashesrequest *FindFullHashesRequest) *FullHashesFindCall {
  1650. c := &FullHashesFindCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1651. c.findfullhashesrequest = findfullhashesrequest
  1652. return c
  1653. }
  1654. // Fields allows partial responses to be retrieved. See
  1655. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1656. // for more information.
  1657. func (c *FullHashesFindCall) Fields(s ...googleapi.Field) *FullHashesFindCall {
  1658. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1659. return c
  1660. }
  1661. // Context sets the context to be used in this call's Do method. Any
  1662. // pending HTTP request will be aborted if the provided context is
  1663. // canceled.
  1664. func (c *FullHashesFindCall) Context(ctx context.Context) *FullHashesFindCall {
  1665. c.ctx_ = ctx
  1666. return c
  1667. }
  1668. // Header returns an http.Header that can be modified by the caller to
  1669. // add HTTP headers to the request.
  1670. func (c *FullHashesFindCall) Header() http.Header {
  1671. if c.header_ == nil {
  1672. c.header_ = make(http.Header)
  1673. }
  1674. return c.header_
  1675. }
  1676. func (c *FullHashesFindCall) doRequest(alt string) (*http.Response, error) {
  1677. reqHeaders := make(http.Header)
  1678. for k, v := range c.header_ {
  1679. reqHeaders[k] = v
  1680. }
  1681. reqHeaders.Set("User-Agent", c.s.userAgent())
  1682. var body io.Reader = nil
  1683. body, err := googleapi.WithoutDataWrapper.JSONReader(c.findfullhashesrequest)
  1684. if err != nil {
  1685. return nil, err
  1686. }
  1687. reqHeaders.Set("Content-Type", "application/json")
  1688. c.urlParams_.Set("alt", alt)
  1689. c.urlParams_.Set("prettyPrint", "false")
  1690. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/fullHashes:find")
  1691. urls += "?" + c.urlParams_.Encode()
  1692. req, err := http.NewRequest("POST", urls, body)
  1693. if err != nil {
  1694. return nil, err
  1695. }
  1696. req.Header = reqHeaders
  1697. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1698. }
  1699. // Do executes the "safebrowsing.fullHashes.find" call.
  1700. // Exactly one of *FindFullHashesResponse or error will be non-nil. Any
  1701. // non-2xx status code is an error. Response headers are in either
  1702. // *FindFullHashesResponse.ServerResponse.Header or (if a response was
  1703. // returned at all) in error.(*googleapi.Error).Header. Use
  1704. // googleapi.IsNotModified to check whether the returned error was
  1705. // because http.StatusNotModified was returned.
  1706. func (c *FullHashesFindCall) Do(opts ...googleapi.CallOption) (*FindFullHashesResponse, error) {
  1707. gensupport.SetOptions(c.urlParams_, opts...)
  1708. res, err := c.doRequest("json")
  1709. if res != nil && res.StatusCode == http.StatusNotModified {
  1710. if res.Body != nil {
  1711. res.Body.Close()
  1712. }
  1713. return nil, &googleapi.Error{
  1714. Code: res.StatusCode,
  1715. Header: res.Header,
  1716. }
  1717. }
  1718. if err != nil {
  1719. return nil, err
  1720. }
  1721. defer googleapi.CloseBody(res)
  1722. if err := googleapi.CheckResponse(res); err != nil {
  1723. return nil, err
  1724. }
  1725. ret := &FindFullHashesResponse{
  1726. ServerResponse: googleapi.ServerResponse{
  1727. Header: res.Header,
  1728. HTTPStatusCode: res.StatusCode,
  1729. },
  1730. }
  1731. target := &ret
  1732. if err := gensupport.DecodeResponse(target, res); err != nil {
  1733. return nil, err
  1734. }
  1735. return ret, nil
  1736. // {
  1737. // "description": "Finds the full hashes that match the requested hash prefixes.",
  1738. // "flatPath": "v4/fullHashes:find",
  1739. // "httpMethod": "POST",
  1740. // "id": "safebrowsing.fullHashes.find",
  1741. // "parameterOrder": [],
  1742. // "parameters": {},
  1743. // "path": "v4/fullHashes:find",
  1744. // "request": {
  1745. // "$ref": "FindFullHashesRequest"
  1746. // },
  1747. // "response": {
  1748. // "$ref": "FindFullHashesResponse"
  1749. // }
  1750. // }
  1751. }
  1752. // method id "safebrowsing.threatHits.create":
  1753. type ThreatHitsCreateCall struct {
  1754. s *Service
  1755. threathit *ThreatHit
  1756. urlParams_ gensupport.URLParams
  1757. ctx_ context.Context
  1758. header_ http.Header
  1759. }
  1760. // Create: Reports a Safe Browsing threat list hit to Google. Only
  1761. // projects with
  1762. // TRUSTED_REPORTER visibility can use this method.
  1763. func (r *ThreatHitsService) Create(threathit *ThreatHit) *ThreatHitsCreateCall {
  1764. c := &ThreatHitsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1765. c.threathit = threathit
  1766. return c
  1767. }
  1768. // Fields allows partial responses to be retrieved. See
  1769. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1770. // for more information.
  1771. func (c *ThreatHitsCreateCall) Fields(s ...googleapi.Field) *ThreatHitsCreateCall {
  1772. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1773. return c
  1774. }
  1775. // Context sets the context to be used in this call's Do method. Any
  1776. // pending HTTP request will be aborted if the provided context is
  1777. // canceled.
  1778. func (c *ThreatHitsCreateCall) Context(ctx context.Context) *ThreatHitsCreateCall {
  1779. c.ctx_ = ctx
  1780. return c
  1781. }
  1782. // Header returns an http.Header that can be modified by the caller to
  1783. // add HTTP headers to the request.
  1784. func (c *ThreatHitsCreateCall) Header() http.Header {
  1785. if c.header_ == nil {
  1786. c.header_ = make(http.Header)
  1787. }
  1788. return c.header_
  1789. }
  1790. func (c *ThreatHitsCreateCall) doRequest(alt string) (*http.Response, error) {
  1791. reqHeaders := make(http.Header)
  1792. for k, v := range c.header_ {
  1793. reqHeaders[k] = v
  1794. }
  1795. reqHeaders.Set("User-Agent", c.s.userAgent())
  1796. var body io.Reader = nil
  1797. body, err := googleapi.WithoutDataWrapper.JSONReader(c.threathit)
  1798. if err != nil {
  1799. return nil, err
  1800. }
  1801. reqHeaders.Set("Content-Type", "application/json")
  1802. c.urlParams_.Set("alt", alt)
  1803. c.urlParams_.Set("prettyPrint", "false")
  1804. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/threatHits")
  1805. urls += "?" + c.urlParams_.Encode()
  1806. req, err := http.NewRequest("POST", urls, body)
  1807. if err != nil {
  1808. return nil, err
  1809. }
  1810. req.Header = reqHeaders
  1811. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1812. }
  1813. // Do executes the "safebrowsing.threatHits.create" call.
  1814. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1815. // code is an error. Response headers are in either
  1816. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1817. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1818. // check whether the returned error was because http.StatusNotModified
  1819. // was returned.
  1820. func (c *ThreatHitsCreateCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1821. gensupport.SetOptions(c.urlParams_, opts...)
  1822. res, err := c.doRequest("json")
  1823. if res != nil && res.StatusCode == http.StatusNotModified {
  1824. if res.Body != nil {
  1825. res.Body.Close()
  1826. }
  1827. return nil, &googleapi.Error{
  1828. Code: res.StatusCode,
  1829. Header: res.Header,
  1830. }
  1831. }
  1832. if err != nil {
  1833. return nil, err
  1834. }
  1835. defer googleapi.CloseBody(res)
  1836. if err := googleapi.CheckResponse(res); err != nil {
  1837. return nil, err
  1838. }
  1839. ret := &Empty{
  1840. ServerResponse: googleapi.ServerResponse{
  1841. Header: res.Header,
  1842. HTTPStatusCode: res.StatusCode,
  1843. },
  1844. }
  1845. target := &ret
  1846. if err := gensupport.DecodeResponse(target, res); err != nil {
  1847. return nil, err
  1848. }
  1849. return ret, nil
  1850. // {
  1851. // "description": "Reports a Safe Browsing threat list hit to Google. Only projects with\nTRUSTED_REPORTER visibility can use this method.",
  1852. // "flatPath": "v4/threatHits",
  1853. // "httpMethod": "POST",
  1854. // "id": "safebrowsing.threatHits.create",
  1855. // "parameterOrder": [],
  1856. // "parameters": {},
  1857. // "path": "v4/threatHits",
  1858. // "request": {
  1859. // "$ref": "ThreatHit"
  1860. // },
  1861. // "response": {
  1862. // "$ref": "Empty"
  1863. // }
  1864. // }
  1865. }
  1866. // method id "safebrowsing.threatListUpdates.fetch":
  1867. type ThreatListUpdatesFetchCall struct {
  1868. s *Service
  1869. fetchthreatlistupdatesrequest *FetchThreatListUpdatesRequest
  1870. urlParams_ gensupport.URLParams
  1871. ctx_ context.Context
  1872. header_ http.Header
  1873. }
  1874. // Fetch: Fetches the most recent threat list updates. A client can
  1875. // request updates
  1876. // for multiple lists at once.
  1877. func (r *ThreatListUpdatesService) Fetch(fetchthreatlistupdatesrequest *FetchThreatListUpdatesRequest) *ThreatListUpdatesFetchCall {
  1878. c := &ThreatListUpdatesFetchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1879. c.fetchthreatlistupdatesrequest = fetchthreatlistupdatesrequest
  1880. return c
  1881. }
  1882. // Fields allows partial responses to be retrieved. See
  1883. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1884. // for more information.
  1885. func (c *ThreatListUpdatesFetchCall) Fields(s ...googleapi.Field) *ThreatListUpdatesFetchCall {
  1886. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1887. return c
  1888. }
  1889. // Context sets the context to be used in this call's Do method. Any
  1890. // pending HTTP request will be aborted if the provided context is
  1891. // canceled.
  1892. func (c *ThreatListUpdatesFetchCall) Context(ctx context.Context) *ThreatListUpdatesFetchCall {
  1893. c.ctx_ = ctx
  1894. return c
  1895. }
  1896. // Header returns an http.Header that can be modified by the caller to
  1897. // add HTTP headers to the request.
  1898. func (c *ThreatListUpdatesFetchCall) Header() http.Header {
  1899. if c.header_ == nil {
  1900. c.header_ = make(http.Header)
  1901. }
  1902. return c.header_
  1903. }
  1904. func (c *ThreatListUpdatesFetchCall) doRequest(alt string) (*http.Response, error) {
  1905. reqHeaders := make(http.Header)
  1906. for k, v := range c.header_ {
  1907. reqHeaders[k] = v
  1908. }
  1909. reqHeaders.Set("User-Agent", c.s.userAgent())
  1910. var body io.Reader = nil
  1911. body, err := googleapi.WithoutDataWrapper.JSONReader(c.fetchthreatlistupdatesrequest)
  1912. if err != nil {
  1913. return nil, err
  1914. }
  1915. reqHeaders.Set("Content-Type", "application/json")
  1916. c.urlParams_.Set("alt", alt)
  1917. c.urlParams_.Set("prettyPrint", "false")
  1918. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/threatListUpdates:fetch")
  1919. urls += "?" + c.urlParams_.Encode()
  1920. req, err := http.NewRequest("POST", urls, body)
  1921. if err != nil {
  1922. return nil, err
  1923. }
  1924. req.Header = reqHeaders
  1925. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1926. }
  1927. // Do executes the "safebrowsing.threatListUpdates.fetch" call.
  1928. // Exactly one of *FetchThreatListUpdatesResponse or error will be
  1929. // non-nil. Any non-2xx status code is an error. Response headers are in
  1930. // either *FetchThreatListUpdatesResponse.ServerResponse.Header or (if a
  1931. // response was returned at all) in error.(*googleapi.Error).Header. Use
  1932. // googleapi.IsNotModified to check whether the returned error was
  1933. // because http.StatusNotModified was returned.
  1934. func (c *ThreatListUpdatesFetchCall) Do(opts ...googleapi.CallOption) (*FetchThreatListUpdatesResponse, error) {
  1935. gensupport.SetOptions(c.urlParams_, opts...)
  1936. res, err := c.doRequest("json")
  1937. if res != nil && res.StatusCode == http.StatusNotModified {
  1938. if res.Body != nil {
  1939. res.Body.Close()
  1940. }
  1941. return nil, &googleapi.Error{
  1942. Code: res.StatusCode,
  1943. Header: res.Header,
  1944. }
  1945. }
  1946. if err != nil {
  1947. return nil, err
  1948. }
  1949. defer googleapi.CloseBody(res)
  1950. if err := googleapi.CheckResponse(res); err != nil {
  1951. return nil, err
  1952. }
  1953. ret := &FetchThreatListUpdatesResponse{
  1954. ServerResponse: googleapi.ServerResponse{
  1955. Header: res.Header,
  1956. HTTPStatusCode: res.StatusCode,
  1957. },
  1958. }
  1959. target := &ret
  1960. if err := gensupport.DecodeResponse(target, res); err != nil {
  1961. return nil, err
  1962. }
  1963. return ret, nil
  1964. // {
  1965. // "description": "Fetches the most recent threat list updates. A client can request updates\nfor multiple lists at once.",
  1966. // "flatPath": "v4/threatListUpdates:fetch",
  1967. // "httpMethod": "POST",
  1968. // "id": "safebrowsing.threatListUpdates.fetch",
  1969. // "parameterOrder": [],
  1970. // "parameters": {},
  1971. // "path": "v4/threatListUpdates:fetch",
  1972. // "request": {
  1973. // "$ref": "FetchThreatListUpdatesRequest"
  1974. // },
  1975. // "response": {
  1976. // "$ref": "FetchThreatListUpdatesResponse"
  1977. // }
  1978. // }
  1979. }
  1980. // method id "safebrowsing.threatLists.list":
  1981. type ThreatListsListCall struct {
  1982. s *Service
  1983. urlParams_ gensupport.URLParams
  1984. ifNoneMatch_ string
  1985. ctx_ context.Context
  1986. header_ http.Header
  1987. }
  1988. // List: Lists the Safe Browsing threat lists available for download.
  1989. func (r *ThreatListsService) List() *ThreatListsListCall {
  1990. c := &ThreatListsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1991. return c
  1992. }
  1993. // Fields allows partial responses to be retrieved. See
  1994. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1995. // for more information.
  1996. func (c *ThreatListsListCall) Fields(s ...googleapi.Field) *ThreatListsListCall {
  1997. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1998. return c
  1999. }
  2000. // IfNoneMatch sets the optional parameter which makes the operation
  2001. // fail if the object's ETag matches the given value. This is useful for
  2002. // getting updates only after the object has changed since the last
  2003. // request. Use googleapi.IsNotModified to check whether the response
  2004. // error from Do is the result of In-None-Match.
  2005. func (c *ThreatListsListCall) IfNoneMatch(entityTag string) *ThreatListsListCall {
  2006. c.ifNoneMatch_ = entityTag
  2007. return c
  2008. }
  2009. // Context sets the context to be used in this call's Do method. Any
  2010. // pending HTTP request will be aborted if the provided context is
  2011. // canceled.
  2012. func (c *ThreatListsListCall) Context(ctx context.Context) *ThreatListsListCall {
  2013. c.ctx_ = ctx
  2014. return c
  2015. }
  2016. // Header returns an http.Header that can be modified by the caller to
  2017. // add HTTP headers to the request.
  2018. func (c *ThreatListsListCall) Header() http.Header {
  2019. if c.header_ == nil {
  2020. c.header_ = make(http.Header)
  2021. }
  2022. return c.header_
  2023. }
  2024. func (c *ThreatListsListCall) doRequest(alt string) (*http.Response, error) {
  2025. reqHeaders := make(http.Header)
  2026. for k, v := range c.header_ {
  2027. reqHeaders[k] = v
  2028. }
  2029. reqHeaders.Set("User-Agent", c.s.userAgent())
  2030. if c.ifNoneMatch_ != "" {
  2031. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2032. }
  2033. var body io.Reader = nil
  2034. c.urlParams_.Set("alt", alt)
  2035. c.urlParams_.Set("prettyPrint", "false")
  2036. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/threatLists")
  2037. urls += "?" + c.urlParams_.Encode()
  2038. req, err := http.NewRequest("GET", urls, body)
  2039. if err != nil {
  2040. return nil, err
  2041. }
  2042. req.Header = reqHeaders
  2043. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2044. }
  2045. // Do executes the "safebrowsing.threatLists.list" call.
  2046. // Exactly one of *ListThreatListsResponse or error will be non-nil. Any
  2047. // non-2xx status code is an error. Response headers are in either
  2048. // *ListThreatListsResponse.ServerResponse.Header or (if a response was
  2049. // returned at all) in error.(*googleapi.Error).Header. Use
  2050. // googleapi.IsNotModified to check whether the returned error was
  2051. // because http.StatusNotModified was returned.
  2052. func (c *ThreatListsListCall) Do(opts ...googleapi.CallOption) (*ListThreatListsResponse, error) {
  2053. gensupport.SetOptions(c.urlParams_, opts...)
  2054. res, err := c.doRequest("json")
  2055. if res != nil && res.StatusCode == http.StatusNotModified {
  2056. if res.Body != nil {
  2057. res.Body.Close()
  2058. }
  2059. return nil, &googleapi.Error{
  2060. Code: res.StatusCode,
  2061. Header: res.Header,
  2062. }
  2063. }
  2064. if err != nil {
  2065. return nil, err
  2066. }
  2067. defer googleapi.CloseBody(res)
  2068. if err := googleapi.CheckResponse(res); err != nil {
  2069. return nil, err
  2070. }
  2071. ret := &ListThreatListsResponse{
  2072. ServerResponse: googleapi.ServerResponse{
  2073. Header: res.Header,
  2074. HTTPStatusCode: res.StatusCode,
  2075. },
  2076. }
  2077. target := &ret
  2078. if err := gensupport.DecodeResponse(target, res); err != nil {
  2079. return nil, err
  2080. }
  2081. return ret, nil
  2082. // {
  2083. // "description": "Lists the Safe Browsing threat lists available for download.",
  2084. // "flatPath": "v4/threatLists",
  2085. // "httpMethod": "GET",
  2086. // "id": "safebrowsing.threatLists.list",
  2087. // "parameterOrder": [],
  2088. // "parameters": {},
  2089. // "path": "v4/threatLists",
  2090. // "response": {
  2091. // "$ref": "ListThreatListsResponse"
  2092. // }
  2093. // }
  2094. }
  2095. // method id "safebrowsing.threatMatches.find":
  2096. type ThreatMatchesFindCall struct {
  2097. s *Service
  2098. findthreatmatchesrequest *FindThreatMatchesRequest
  2099. urlParams_ gensupport.URLParams
  2100. ctx_ context.Context
  2101. header_ http.Header
  2102. }
  2103. // Find: Finds the threat entries that match the Safe Browsing lists.
  2104. func (r *ThreatMatchesService) Find(findthreatmatchesrequest *FindThreatMatchesRequest) *ThreatMatchesFindCall {
  2105. c := &ThreatMatchesFindCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2106. c.findthreatmatchesrequest = findthreatmatchesrequest
  2107. return c
  2108. }
  2109. // Fields allows partial responses to be retrieved. See
  2110. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2111. // for more information.
  2112. func (c *ThreatMatchesFindCall) Fields(s ...googleapi.Field) *ThreatMatchesFindCall {
  2113. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2114. return c
  2115. }
  2116. // Context sets the context to be used in this call's Do method. Any
  2117. // pending HTTP request will be aborted if the provided context is
  2118. // canceled.
  2119. func (c *ThreatMatchesFindCall) Context(ctx context.Context) *ThreatMatchesFindCall {
  2120. c.ctx_ = ctx
  2121. return c
  2122. }
  2123. // Header returns an http.Header that can be modified by the caller to
  2124. // add HTTP headers to the request.
  2125. func (c *ThreatMatchesFindCall) Header() http.Header {
  2126. if c.header_ == nil {
  2127. c.header_ = make(http.Header)
  2128. }
  2129. return c.header_
  2130. }
  2131. func (c *ThreatMatchesFindCall) doRequest(alt string) (*http.Response, error) {
  2132. reqHeaders := make(http.Header)
  2133. for k, v := range c.header_ {
  2134. reqHeaders[k] = v
  2135. }
  2136. reqHeaders.Set("User-Agent", c.s.userAgent())
  2137. var body io.Reader = nil
  2138. body, err := googleapi.WithoutDataWrapper.JSONReader(c.findthreatmatchesrequest)
  2139. if err != nil {
  2140. return nil, err
  2141. }
  2142. reqHeaders.Set("Content-Type", "application/json")
  2143. c.urlParams_.Set("alt", alt)
  2144. c.urlParams_.Set("prettyPrint", "false")
  2145. urls := googleapi.ResolveRelative(c.s.BasePath, "v4/threatMatches:find")
  2146. urls += "?" + c.urlParams_.Encode()
  2147. req, err := http.NewRequest("POST", urls, body)
  2148. if err != nil {
  2149. return nil, err
  2150. }
  2151. req.Header = reqHeaders
  2152. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2153. }
  2154. // Do executes the "safebrowsing.threatMatches.find" call.
  2155. // Exactly one of *FindThreatMatchesResponse or error will be non-nil.
  2156. // Any non-2xx status code is an error. Response headers are in either
  2157. // *FindThreatMatchesResponse.ServerResponse.Header or (if a response
  2158. // was returned at all) in error.(*googleapi.Error).Header. Use
  2159. // googleapi.IsNotModified to check whether the returned error was
  2160. // because http.StatusNotModified was returned.
  2161. func (c *ThreatMatchesFindCall) Do(opts ...googleapi.CallOption) (*FindThreatMatchesResponse, error) {
  2162. gensupport.SetOptions(c.urlParams_, opts...)
  2163. res, err := c.doRequest("json")
  2164. if res != nil && res.StatusCode == http.StatusNotModified {
  2165. if res.Body != nil {
  2166. res.Body.Close()
  2167. }
  2168. return nil, &googleapi.Error{
  2169. Code: res.StatusCode,
  2170. Header: res.Header,
  2171. }
  2172. }
  2173. if err != nil {
  2174. return nil, err
  2175. }
  2176. defer googleapi.CloseBody(res)
  2177. if err := googleapi.CheckResponse(res); err != nil {
  2178. return nil, err
  2179. }
  2180. ret := &FindThreatMatchesResponse{
  2181. ServerResponse: googleapi.ServerResponse{
  2182. Header: res.Header,
  2183. HTTPStatusCode: res.StatusCode,
  2184. },
  2185. }
  2186. target := &ret
  2187. if err := gensupport.DecodeResponse(target, res); err != nil {
  2188. return nil, err
  2189. }
  2190. return ret, nil
  2191. // {
  2192. // "description": "Finds the threat entries that match the Safe Browsing lists.",
  2193. // "flatPath": "v4/threatMatches:find",
  2194. // "httpMethod": "POST",
  2195. // "id": "safebrowsing.threatMatches.find",
  2196. // "parameterOrder": [],
  2197. // "parameters": {},
  2198. // "path": "v4/threatMatches:find",
  2199. // "request": {
  2200. // "$ref": "FindThreatMatchesRequest"
  2201. // },
  2202. // "response": {
  2203. // "$ref": "FindThreatMatchesResponse"
  2204. // }
  2205. // }
  2206. }