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.
 
 
 

2384 regels
87 KiB

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