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.
 
 
 

1285 lines
54 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package digitalassetlinks provides access to the Digital Asset Links API.
  6. //
  7. // For product documentation, see: https://developers.google.com/digital-asset-links/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/digitalassetlinks/v1"
  14. // ...
  15. // ctx := context.Background()
  16. // digitalassetlinksService, err := digitalassetlinks.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // digitalassetlinksService, err := digitalassetlinks.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // digitalassetlinksService, err := digitalassetlinks.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package digitalassetlinks // import "google.golang.org/api/digitalassetlinks/v1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "digitalassetlinks:v1"
  67. const apiName = "digitalassetlinks"
  68. const apiVersion = "v1"
  69. const basePath = "https://digitalassetlinks.googleapis.com/"
  70. // NewService creates a new Service.
  71. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  72. client, endpoint, err := htransport.NewClient(ctx, opts...)
  73. if err != nil {
  74. return nil, err
  75. }
  76. s, err := New(client)
  77. if err != nil {
  78. return nil, err
  79. }
  80. if endpoint != "" {
  81. s.BasePath = endpoint
  82. }
  83. return s, nil
  84. }
  85. // New creates a new Service. It uses the provided http.Client for requests.
  86. //
  87. // Deprecated: please use NewService instead.
  88. // To provide a custom HTTP client, use option.WithHTTPClient.
  89. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  90. func New(client *http.Client) (*Service, error) {
  91. if client == nil {
  92. return nil, errors.New("client is nil")
  93. }
  94. s := &Service{client: client, BasePath: basePath}
  95. s.Assetlinks = NewAssetlinksService(s)
  96. s.Statements = NewStatementsService(s)
  97. return s, nil
  98. }
  99. type Service struct {
  100. client *http.Client
  101. BasePath string // API endpoint base URL
  102. UserAgent string // optional additional User-Agent fragment
  103. Assetlinks *AssetlinksService
  104. Statements *StatementsService
  105. }
  106. func (s *Service) userAgent() string {
  107. if s.UserAgent == "" {
  108. return googleapi.UserAgent
  109. }
  110. return googleapi.UserAgent + " " + s.UserAgent
  111. }
  112. func NewAssetlinksService(s *Service) *AssetlinksService {
  113. rs := &AssetlinksService{s: s}
  114. return rs
  115. }
  116. type AssetlinksService struct {
  117. s *Service
  118. }
  119. func NewStatementsService(s *Service) *StatementsService {
  120. rs := &StatementsService{s: s}
  121. return rs
  122. }
  123. type StatementsService struct {
  124. s *Service
  125. }
  126. // AndroidAppAsset: Describes an android app asset.
  127. type AndroidAppAsset struct {
  128. // Certificate: Because there is no global enforcement of package name
  129. // uniqueness, we also
  130. // require a signing certificate, which in combination with the package
  131. // name
  132. // uniquely identifies an app.
  133. //
  134. // Some apps' signing keys are rotated, so they may be signed by
  135. // different
  136. // keys over time. We treat these as distinct assets, since we use
  137. // (package
  138. // name, cert) as the unique ID. This should not normally pose any
  139. // problems
  140. // as both versions of the app will make the same or similar
  141. // statements.
  142. // Other assets making statements about the app will have to be updated
  143. // when a
  144. // key is rotated, however.
  145. //
  146. // (Note that the syntaxes for publishing and querying for statements
  147. // contain
  148. // syntactic sugar to easily let you specify apps that are known by
  149. // multiple
  150. // certificates.)
  151. // REQUIRED
  152. Certificate *CertificateInfo `json:"certificate,omitempty"`
  153. // PackageName: Android App assets are naturally identified by their
  154. // Java package name.
  155. // For example, the Google Maps app uses the package
  156. // name
  157. // `com.google.android.apps.maps`.
  158. // REQUIRED
  159. PackageName string `json:"packageName,omitempty"`
  160. // ForceSendFields is a list of field names (e.g. "Certificate") 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. "Certificate") to include
  168. // in API requests with the JSON null value. By default, fields with
  169. // empty values are omitted from API requests. However, any field with
  170. // an 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 *AndroidAppAsset) MarshalJSON() ([]byte, error) {
  176. type NoMethod AndroidAppAsset
  177. raw := NoMethod(*s)
  178. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  179. }
  180. // Asset: Uniquely identifies an asset.
  181. //
  182. // A digital asset is an identifiable and addressable online entity
  183. // that
  184. // typically provides some service or content. Examples of assets are
  185. // websites,
  186. // Android apps, Twitter feeds, and Plus Pages.
  187. type Asset struct {
  188. // AndroidApp: Set if this is an Android App asset.
  189. AndroidApp *AndroidAppAsset `json:"androidApp,omitempty"`
  190. // Web: Set if this is a web asset.
  191. Web *WebAsset `json:"web,omitempty"`
  192. // ForceSendFields is a list of field names (e.g. "AndroidApp") to
  193. // unconditionally include in API requests. By default, fields with
  194. // empty values are omitted from API requests. However, any non-pointer,
  195. // non-interface field appearing in ForceSendFields will be sent to the
  196. // server regardless of whether the field is empty or not. This may be
  197. // used to include empty fields in Patch requests.
  198. ForceSendFields []string `json:"-"`
  199. // NullFields is a list of field names (e.g. "AndroidApp") to include in
  200. // API requests with the JSON null value. By default, fields with empty
  201. // values are omitted from API requests. However, any field with an
  202. // empty value appearing in NullFields will be sent to the server as
  203. // null. It is an error if a field in this list has a non-empty value.
  204. // This may be used to include null fields in Patch requests.
  205. NullFields []string `json:"-"`
  206. }
  207. func (s *Asset) MarshalJSON() ([]byte, error) {
  208. type NoMethod Asset
  209. raw := NoMethod(*s)
  210. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  211. }
  212. // CertificateInfo: Describes an X509 certificate.
  213. type CertificateInfo struct {
  214. // Sha256Fingerprint: The uppercase SHA-265 fingerprint of the
  215. // certificate. From the PEM
  216. // certificate, it can be acquired like this:
  217. //
  218. // $ keytool -printcert -file $CERTFILE | grep SHA256:
  219. // SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:
  220. // \
  221. // 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  222. //
  223. // or like this:
  224. //
  225. // $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256
  226. // SHA256
  227. // Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
  228. // 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  229. //
  230. // In this example, the contents of this field would be
  231. // `14:6D:E9:83:C5:73:
  232. // 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE
  233. // :A8:8A:04:96:B2:3F:CF:
  234. // 44:E5`.
  235. //
  236. // If these tools are not available to you, you can convert the
  237. // PEM
  238. // certificate into the DER format, compute the SHA-256 hash of that
  239. // string
  240. // and represent the result as a hexstring (that is, uppercase
  241. // hexadecimal
  242. // representations of each octet, separated by colons).
  243. Sha256Fingerprint string `json:"sha256Fingerprint,omitempty"`
  244. // ForceSendFields is a list of field names (e.g. "Sha256Fingerprint")
  245. // to unconditionally include in API requests. By default, fields with
  246. // empty values are omitted from API requests. However, any non-pointer,
  247. // non-interface field appearing in ForceSendFields will be sent to the
  248. // server regardless of whether the field is empty or not. This may be
  249. // used to include empty fields in Patch requests.
  250. ForceSendFields []string `json:"-"`
  251. // NullFields is a list of field names (e.g. "Sha256Fingerprint") to
  252. // include in API requests with the JSON null value. By default, fields
  253. // with empty values are omitted from API requests. However, any field
  254. // with an empty value appearing in NullFields will be sent to the
  255. // server as null. It is an error if a field in this list has a
  256. // non-empty value. This may be used to include null fields in Patch
  257. // requests.
  258. NullFields []string `json:"-"`
  259. }
  260. func (s *CertificateInfo) MarshalJSON() ([]byte, error) {
  261. type NoMethod CertificateInfo
  262. raw := NoMethod(*s)
  263. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  264. }
  265. // CheckResponse: Response message for the CheckAssetLinks call.
  266. type CheckResponse struct {
  267. // DebugString: Human-readable message containing information intended
  268. // to help end users
  269. // understand, reproduce and debug the result.
  270. //
  271. //
  272. // The message will be in English and we are currently not planning to
  273. // offer
  274. // any translations.
  275. //
  276. // Please note that no guarantees are made about the contents or format
  277. // of
  278. // this string. Any aspect of it may be subject to change without
  279. // notice.
  280. // You should not attempt to programmatically parse this data.
  281. // For
  282. // programmatic access, use the error_code field below.
  283. DebugString string `json:"debugString,omitempty"`
  284. // ErrorCode: Error codes that describe the result of the Check
  285. // operation.
  286. //
  287. // Possible values:
  288. // "ERROR_CODE_UNSPECIFIED"
  289. // "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
  290. // "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
  291. // "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
  292. // "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
  293. // "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
  294. // "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
  295. // "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
  296. // application/json.
  297. // "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
  298. // "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset
  299. // includes an insecure asset (security downgrade).
  300. // "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a
  301. // loop).
  302. ErrorCode []string `json:"errorCode,omitempty"`
  303. // Linked: Set to true if the assets specified in the request are linked
  304. // by the
  305. // relation specified in the request.
  306. Linked bool `json:"linked,omitempty"`
  307. // MaxAge: From serving time, how much longer the response should be
  308. // considered valid
  309. // barring further updates.
  310. // REQUIRED
  311. MaxAge string `json:"maxAge,omitempty"`
  312. // ServerResponse contains the HTTP response code and headers from the
  313. // server.
  314. googleapi.ServerResponse `json:"-"`
  315. // ForceSendFields is a list of field names (e.g. "DebugString") to
  316. // unconditionally include in API requests. By default, fields with
  317. // empty values are omitted from API requests. However, any non-pointer,
  318. // non-interface field appearing in ForceSendFields will be sent to the
  319. // server regardless of whether the field is empty or not. This may be
  320. // used to include empty fields in Patch requests.
  321. ForceSendFields []string `json:"-"`
  322. // NullFields is a list of field names (e.g. "DebugString") to include
  323. // in API requests with the JSON null value. By default, fields with
  324. // empty values are omitted from API requests. However, any field with
  325. // an empty value appearing in NullFields will be sent to the server as
  326. // null. It is an error if a field in this list has a non-empty value.
  327. // This may be used to include null fields in Patch requests.
  328. NullFields []string `json:"-"`
  329. }
  330. func (s *CheckResponse) MarshalJSON() ([]byte, error) {
  331. type NoMethod CheckResponse
  332. raw := NoMethod(*s)
  333. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  334. }
  335. // ListResponse: Response message for the List call.
  336. type ListResponse struct {
  337. // DebugString: Human-readable message containing information intended
  338. // to help end users
  339. // understand, reproduce and debug the result.
  340. //
  341. //
  342. // The message will be in English and we are currently not planning to
  343. // offer
  344. // any translations.
  345. //
  346. // Please note that no guarantees are made about the contents or format
  347. // of
  348. // this string. Any aspect of it may be subject to change without
  349. // notice.
  350. // You should not attempt to programmatically parse this data.
  351. // For
  352. // programmatic access, use the error_code field below.
  353. DebugString string `json:"debugString,omitempty"`
  354. // ErrorCode: Error codes that describe the result of the List
  355. // operation.
  356. //
  357. // Possible values:
  358. // "ERROR_CODE_UNSPECIFIED"
  359. // "ERROR_CODE_INVALID_QUERY" - Unable to parse query.
  360. // "ERROR_CODE_FETCH_ERROR" - Unable to fetch the asset links data.
  361. // "ERROR_CODE_FAILED_SSL_VALIDATION" - Invalid HTTPS certificate .
  362. // "ERROR_CODE_REDIRECT" - HTTP redirects (e.g, 301) are not allowed.
  363. // "ERROR_CODE_TOO_LARGE" - Asset links data exceeds maximum size.
  364. // "ERROR_CODE_MALFORMED_HTTP_RESPONSE" - Can't parse HTTP response.
  365. // "ERROR_CODE_WRONG_CONTENT_TYPE" - HTTP Content-type should be
  366. // application/json.
  367. // "ERROR_CODE_MALFORMED_CONTENT" - JSON content is malformed.
  368. // "ERROR_CODE_SECURE_ASSET_INCLUDES_INSECURE" - A secure asset
  369. // includes an insecure asset (security downgrade).
  370. // "ERROR_CODE_FETCH_BUDGET_EXHAUSTED" - Too many includes (maybe a
  371. // loop).
  372. ErrorCode []string `json:"errorCode,omitempty"`
  373. // MaxAge: From serving time, how much longer the response should be
  374. // considered valid
  375. // barring further updates.
  376. // REQUIRED
  377. MaxAge string `json:"maxAge,omitempty"`
  378. // Statements: A list of all the matching statements that have been
  379. // found.
  380. Statements []*Statement `json:"statements,omitempty"`
  381. // ServerResponse contains the HTTP response code and headers from the
  382. // server.
  383. googleapi.ServerResponse `json:"-"`
  384. // ForceSendFields is a list of field names (e.g. "DebugString") to
  385. // unconditionally include in API requests. By default, fields with
  386. // empty values are omitted from API requests. However, any non-pointer,
  387. // non-interface field appearing in ForceSendFields will be sent to the
  388. // server regardless of whether the field is empty or not. This may be
  389. // used to include empty fields in Patch requests.
  390. ForceSendFields []string `json:"-"`
  391. // NullFields is a list of field names (e.g. "DebugString") to include
  392. // in API requests with the JSON null value. By default, fields with
  393. // empty values are omitted from API requests. However, any field with
  394. // an empty value appearing in NullFields will be sent to the server as
  395. // null. It is an error if a field in this list has a non-empty value.
  396. // This may be used to include null fields in Patch requests.
  397. NullFields []string `json:"-"`
  398. }
  399. func (s *ListResponse) MarshalJSON() ([]byte, error) {
  400. type NoMethod ListResponse
  401. raw := NoMethod(*s)
  402. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  403. }
  404. // Statement: Describes a reliable statement that has been made about
  405. // the relationship
  406. // between a source asset and a target asset.
  407. //
  408. // Statements are always made by the source asset, either directly or
  409. // by
  410. // delegating to a statement list that is stored elsewhere.
  411. //
  412. // For more detailed definitions of statements and assets, please
  413. // refer
  414. // to our [API documentation
  415. // landing
  416. // page](/digital-asset-links/v1/getting-started).
  417. type Statement struct {
  418. // Relation: The relation identifies the use of the statement as
  419. // intended by the source
  420. // asset's owner (that is, the person or entity who issued the
  421. // statement).
  422. // Every complete statement has a relation.
  423. //
  424. // We identify relations with strings of the format `<kind>/<detail>`,
  425. // where
  426. // `<kind>` must be one of a set of pre-defined purpose categories,
  427. // and
  428. // `<detail>` is a free-form lowercase alphanumeric string that
  429. // describes the
  430. // specific use case of the statement.
  431. //
  432. // Refer to [our API
  433. // documentation](/digital-asset-links/v1/relation-strings)
  434. // for the current list of supported relations.
  435. //
  436. // Example: `delegate_permission/common.handle_all_urls`
  437. // REQUIRED
  438. Relation string `json:"relation,omitempty"`
  439. // Source: Every statement has a source asset.
  440. // REQUIRED
  441. Source *Asset `json:"source,omitempty"`
  442. // Target: Every statement has a target asset.
  443. // REQUIRED
  444. Target *Asset `json:"target,omitempty"`
  445. // ForceSendFields is a list of field names (e.g. "Relation") to
  446. // unconditionally include in API requests. By default, fields with
  447. // empty values are omitted from API requests. However, any non-pointer,
  448. // non-interface field appearing in ForceSendFields will be sent to the
  449. // server regardless of whether the field is empty or not. This may be
  450. // used to include empty fields in Patch requests.
  451. ForceSendFields []string `json:"-"`
  452. // NullFields is a list of field names (e.g. "Relation") to include in
  453. // API requests with the JSON null value. By default, fields with empty
  454. // values are omitted from API requests. However, any field with an
  455. // empty value appearing in NullFields will be sent to the server as
  456. // null. It is an error if a field in this list has a non-empty value.
  457. // This may be used to include null fields in Patch requests.
  458. NullFields []string `json:"-"`
  459. }
  460. func (s *Statement) MarshalJSON() ([]byte, error) {
  461. type NoMethod Statement
  462. raw := NoMethod(*s)
  463. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  464. }
  465. // WebAsset: Describes a web asset.
  466. type WebAsset struct {
  467. // Site: Web assets are identified by a URL that contains only the
  468. // scheme, hostname
  469. // and port parts. The format is
  470. //
  471. // http[s]://<hostname>[:<port>]
  472. //
  473. // Hostnames must be fully qualified: they must end in a single
  474. // period
  475. // (".").
  476. //
  477. // Only the schemes "http" and "https" are currently allowed.
  478. //
  479. // Port numbers are given as a decimal number, and they must be omitted
  480. // if the
  481. // standard port numbers are used: 80 for http and 443 for https.
  482. //
  483. // We call this limited URL the "site". All URLs that share the same
  484. // scheme,
  485. // hostname and port are considered to be a part of the site and thus
  486. // belong
  487. // to the web asset.
  488. //
  489. // Example: the asset with the site `https://www.google.com` contains
  490. // all
  491. // these URLs:
  492. //
  493. // * `https://www.google.com/`
  494. // * `https://www.google.com:443/`
  495. // * `https://www.google.com/foo`
  496. // * `https://www.google.com/foo?bar`
  497. // * `https://www.google.com/foo#bar`
  498. // * `https://user@password:www.google.com/`
  499. //
  500. // But it does not contain these URLs:
  501. //
  502. // * `http://www.google.com/` (wrong scheme)
  503. // * `https://google.com/` (hostname does not match)
  504. // * `https://www.google.com:444/` (port does not match)
  505. // REQUIRED
  506. Site string `json:"site,omitempty"`
  507. // ForceSendFields is a list of field names (e.g. "Site") to
  508. // unconditionally include in API requests. By default, fields with
  509. // empty values are omitted from API requests. However, any non-pointer,
  510. // non-interface field appearing in ForceSendFields will be sent to the
  511. // server regardless of whether the field is empty or not. This may be
  512. // used to include empty fields in Patch requests.
  513. ForceSendFields []string `json:"-"`
  514. // NullFields is a list of field names (e.g. "Site") to include in API
  515. // requests with the JSON null value. By default, fields with empty
  516. // values are omitted from API requests. However, any field with an
  517. // empty value appearing in NullFields will be sent to the server as
  518. // null. It is an error if a field in this list has a non-empty value.
  519. // This may be used to include null fields in Patch requests.
  520. NullFields []string `json:"-"`
  521. }
  522. func (s *WebAsset) MarshalJSON() ([]byte, error) {
  523. type NoMethod WebAsset
  524. raw := NoMethod(*s)
  525. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  526. }
  527. // method id "digitalassetlinks.assetlinks.check":
  528. type AssetlinksCheckCall struct {
  529. s *Service
  530. urlParams_ gensupport.URLParams
  531. ifNoneMatch_ string
  532. ctx_ context.Context
  533. header_ http.Header
  534. }
  535. // Check: Determines whether the specified (directional) relationship
  536. // exists between
  537. // the specified source and target assets.
  538. //
  539. // The relation describes the intent of the link between the two assets
  540. // as
  541. // claimed by the source asset. An example for such relationships is
  542. // the
  543. // delegation of privileges or permissions.
  544. //
  545. // This command is most often used by infrastructure systems to
  546. // check
  547. // preconditions for an action. For example, a client may want to know
  548. // if it
  549. // is OK to send a web URL to a particular mobile app instead. The
  550. // client can
  551. // check for the relevant asset link from the website to the mobile app
  552. // to
  553. // decide if the operation should be allowed.
  554. //
  555. // A note about security: if you specify a secure asset as the source,
  556. // such as
  557. // an HTTPS website or an Android app, the API will ensure that
  558. // any
  559. // statements used to generate the response have been made in a secure
  560. // way by
  561. // the owner of that asset. Conversely, if the source asset is an
  562. // insecure
  563. // HTTP website (that is, the URL starts with `http://` instead of
  564. // `https://`),
  565. // the API cannot verify its statements securely, and it is not possible
  566. // to
  567. // ensure that the website's statements have not been altered by a
  568. // third
  569. // party. For more information, see the [Digital Asset Links technical
  570. // design
  571. // specification](https://github.com/google/digitalassetlinks/blob
  572. // /master/well-known/details.md).
  573. func (r *AssetlinksService) Check() *AssetlinksCheckCall {
  574. c := &AssetlinksCheckCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  575. return c
  576. }
  577. // Relation sets the optional parameter "relation": Query string for the
  578. // relation.
  579. //
  580. // We identify relations with strings of the format `<kind>/<detail>`,
  581. // where
  582. // `<kind>` must be one of a set of pre-defined purpose categories,
  583. // and
  584. // `<detail>` is a free-form lowercase alphanumeric string that
  585. // describes the
  586. // specific use case of the statement.
  587. //
  588. // Refer to [our API
  589. // documentation](/digital-asset-links/v1/relation-strings)
  590. // for the current list of supported relations.
  591. //
  592. // For a query to match an asset link, both the query's and the asset
  593. // link's
  594. // relation strings must match exactly.
  595. //
  596. // Example: A query with relation
  597. // `delegate_permission/common.handle_all_urls`
  598. // matches an asset link with
  599. // relation
  600. // `delegate_permission/common.handle_all_urls`.
  601. func (c *AssetlinksCheckCall) Relation(relation string) *AssetlinksCheckCall {
  602. c.urlParams_.Set("relation", relation)
  603. return c
  604. }
  605. // SourceAndroidAppCertificateSha256Fingerprint sets the optional
  606. // parameter "source.androidApp.certificate.sha256Fingerprint": The
  607. // uppercase SHA-265 fingerprint of the certificate. From the PEM
  608. // certificate, it can be acquired like this:
  609. //
  610. // $ keytool -printcert -file $CERTFILE | grep SHA256:
  611. // SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:
  612. // \
  613. // 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  614. //
  615. // or like this:
  616. //
  617. // $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256
  618. // SHA256
  619. // Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
  620. // 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  621. //
  622. // In this example, the contents of this field would be
  623. // `14:6D:E9:83:C5:73:
  624. // 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE
  625. // :A8:8A:04:96:B2:3F:CF:
  626. // 44:E5`.
  627. //
  628. // If these tools are not available to you, you can convert the
  629. // PEM
  630. // certificate into the DER format, compute the SHA-256 hash of that
  631. // string
  632. // and represent the result as a hexstring (that is, uppercase
  633. // hexadecimal
  634. // representations of each octet, separated by colons).
  635. func (c *AssetlinksCheckCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall {
  636. c.urlParams_.Set("source.androidApp.certificate.sha256Fingerprint", sourceAndroidAppCertificateSha256Fingerprint)
  637. return c
  638. }
  639. // SourceAndroidAppPackageName sets the optional parameter
  640. // "source.androidApp.packageName": Android App assets are naturally
  641. // identified by their Java package name.
  642. // For example, the Google Maps app uses the package
  643. // name
  644. // `com.google.android.apps.maps`.
  645. // REQUIRED
  646. func (c *AssetlinksCheckCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *AssetlinksCheckCall {
  647. c.urlParams_.Set("source.androidApp.packageName", sourceAndroidAppPackageName)
  648. return c
  649. }
  650. // SourceWebSite sets the optional parameter "source.web.site": Web
  651. // assets are identified by a URL that contains only the scheme,
  652. // hostname
  653. // and port parts. The format is
  654. //
  655. // http[s]://<hostname>[:<port>]
  656. //
  657. // Hostnames must be fully qualified: they must end in a single
  658. // period
  659. // (".").
  660. //
  661. // Only the schemes "http" and "https" are currently allowed.
  662. //
  663. // Port numbers are given as a decimal number, and they must be omitted
  664. // if the
  665. // standard port numbers are used: 80 for http and 443 for https.
  666. //
  667. // We call this limited URL the "site". All URLs that share the same
  668. // scheme,
  669. // hostname and port are considered to be a part of the site and thus
  670. // belong
  671. // to the web asset.
  672. //
  673. // Example: the asset with the site `https://www.google.com` contains
  674. // all
  675. // these URLs:
  676. //
  677. // * `https://www.google.com/`
  678. // * `https://www.google.com:443/`
  679. // * `https://www.google.com/foo`
  680. // * `https://www.google.com/foo?bar`
  681. // * `https://www.google.com/foo#bar`
  682. // * `https://user@password:www.google.com/`
  683. //
  684. // But it does not contain these URLs:
  685. //
  686. // * `http://www.google.com/` (wrong scheme)
  687. // * `https://google.com/` (hostname does not match)
  688. // * `https://www.google.com:444/` (port does not match)
  689. // REQUIRED
  690. func (c *AssetlinksCheckCall) SourceWebSite(sourceWebSite string) *AssetlinksCheckCall {
  691. c.urlParams_.Set("source.web.site", sourceWebSite)
  692. return c
  693. }
  694. // TargetAndroidAppCertificateSha256Fingerprint sets the optional
  695. // parameter "target.androidApp.certificate.sha256Fingerprint": The
  696. // uppercase SHA-265 fingerprint of the certificate. From the PEM
  697. // certificate, it can be acquired like this:
  698. //
  699. // $ keytool -printcert -file $CERTFILE | grep SHA256:
  700. // SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:
  701. // \
  702. // 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  703. //
  704. // or like this:
  705. //
  706. // $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256
  707. // SHA256
  708. // Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
  709. // 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  710. //
  711. // In this example, the contents of this field would be
  712. // `14:6D:E9:83:C5:73:
  713. // 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE
  714. // :A8:8A:04:96:B2:3F:CF:
  715. // 44:E5`.
  716. //
  717. // If these tools are not available to you, you can convert the
  718. // PEM
  719. // certificate into the DER format, compute the SHA-256 hash of that
  720. // string
  721. // and represent the result as a hexstring (that is, uppercase
  722. // hexadecimal
  723. // representations of each octet, separated by colons).
  724. func (c *AssetlinksCheckCall) TargetAndroidAppCertificateSha256Fingerprint(targetAndroidAppCertificateSha256Fingerprint string) *AssetlinksCheckCall {
  725. c.urlParams_.Set("target.androidApp.certificate.sha256Fingerprint", targetAndroidAppCertificateSha256Fingerprint)
  726. return c
  727. }
  728. // TargetAndroidAppPackageName sets the optional parameter
  729. // "target.androidApp.packageName": Android App assets are naturally
  730. // identified by their Java package name.
  731. // For example, the Google Maps app uses the package
  732. // name
  733. // `com.google.android.apps.maps`.
  734. // REQUIRED
  735. func (c *AssetlinksCheckCall) TargetAndroidAppPackageName(targetAndroidAppPackageName string) *AssetlinksCheckCall {
  736. c.urlParams_.Set("target.androidApp.packageName", targetAndroidAppPackageName)
  737. return c
  738. }
  739. // TargetWebSite sets the optional parameter "target.web.site": Web
  740. // assets are identified by a URL that contains only the scheme,
  741. // hostname
  742. // and port parts. The format is
  743. //
  744. // http[s]://<hostname>[:<port>]
  745. //
  746. // Hostnames must be fully qualified: they must end in a single
  747. // period
  748. // (".").
  749. //
  750. // Only the schemes "http" and "https" are currently allowed.
  751. //
  752. // Port numbers are given as a decimal number, and they must be omitted
  753. // if the
  754. // standard port numbers are used: 80 for http and 443 for https.
  755. //
  756. // We call this limited URL the "site". All URLs that share the same
  757. // scheme,
  758. // hostname and port are considered to be a part of the site and thus
  759. // belong
  760. // to the web asset.
  761. //
  762. // Example: the asset with the site `https://www.google.com` contains
  763. // all
  764. // these URLs:
  765. //
  766. // * `https://www.google.com/`
  767. // * `https://www.google.com:443/`
  768. // * `https://www.google.com/foo`
  769. // * `https://www.google.com/foo?bar`
  770. // * `https://www.google.com/foo#bar`
  771. // * `https://user@password:www.google.com/`
  772. //
  773. // But it does not contain these URLs:
  774. //
  775. // * `http://www.google.com/` (wrong scheme)
  776. // * `https://google.com/` (hostname does not match)
  777. // * `https://www.google.com:444/` (port does not match)
  778. // REQUIRED
  779. func (c *AssetlinksCheckCall) TargetWebSite(targetWebSite string) *AssetlinksCheckCall {
  780. c.urlParams_.Set("target.web.site", targetWebSite)
  781. return c
  782. }
  783. // Fields allows partial responses to be retrieved. See
  784. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  785. // for more information.
  786. func (c *AssetlinksCheckCall) Fields(s ...googleapi.Field) *AssetlinksCheckCall {
  787. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  788. return c
  789. }
  790. // IfNoneMatch sets the optional parameter which makes the operation
  791. // fail if the object's ETag matches the given value. This is useful for
  792. // getting updates only after the object has changed since the last
  793. // request. Use googleapi.IsNotModified to check whether the response
  794. // error from Do is the result of In-None-Match.
  795. func (c *AssetlinksCheckCall) IfNoneMatch(entityTag string) *AssetlinksCheckCall {
  796. c.ifNoneMatch_ = entityTag
  797. return c
  798. }
  799. // Context sets the context to be used in this call's Do method. Any
  800. // pending HTTP request will be aborted if the provided context is
  801. // canceled.
  802. func (c *AssetlinksCheckCall) Context(ctx context.Context) *AssetlinksCheckCall {
  803. c.ctx_ = ctx
  804. return c
  805. }
  806. // Header returns an http.Header that can be modified by the caller to
  807. // add HTTP headers to the request.
  808. func (c *AssetlinksCheckCall) Header() http.Header {
  809. if c.header_ == nil {
  810. c.header_ = make(http.Header)
  811. }
  812. return c.header_
  813. }
  814. func (c *AssetlinksCheckCall) doRequest(alt string) (*http.Response, error) {
  815. reqHeaders := make(http.Header)
  816. for k, v := range c.header_ {
  817. reqHeaders[k] = v
  818. }
  819. reqHeaders.Set("User-Agent", c.s.userAgent())
  820. if c.ifNoneMatch_ != "" {
  821. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  822. }
  823. var body io.Reader = nil
  824. c.urlParams_.Set("alt", alt)
  825. c.urlParams_.Set("prettyPrint", "false")
  826. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/assetlinks:check")
  827. urls += "?" + c.urlParams_.Encode()
  828. req, err := http.NewRequest("GET", urls, body)
  829. if err != nil {
  830. return nil, err
  831. }
  832. req.Header = reqHeaders
  833. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  834. }
  835. // Do executes the "digitalassetlinks.assetlinks.check" call.
  836. // Exactly one of *CheckResponse or error will be non-nil. Any non-2xx
  837. // status code is an error. Response headers are in either
  838. // *CheckResponse.ServerResponse.Header or (if a response was returned
  839. // at all) in error.(*googleapi.Error).Header. Use
  840. // googleapi.IsNotModified to check whether the returned error was
  841. // because http.StatusNotModified was returned.
  842. func (c *AssetlinksCheckCall) Do(opts ...googleapi.CallOption) (*CheckResponse, error) {
  843. gensupport.SetOptions(c.urlParams_, opts...)
  844. res, err := c.doRequest("json")
  845. if res != nil && res.StatusCode == http.StatusNotModified {
  846. if res.Body != nil {
  847. res.Body.Close()
  848. }
  849. return nil, &googleapi.Error{
  850. Code: res.StatusCode,
  851. Header: res.Header,
  852. }
  853. }
  854. if err != nil {
  855. return nil, err
  856. }
  857. defer googleapi.CloseBody(res)
  858. if err := googleapi.CheckResponse(res); err != nil {
  859. return nil, err
  860. }
  861. ret := &CheckResponse{
  862. ServerResponse: googleapi.ServerResponse{
  863. Header: res.Header,
  864. HTTPStatusCode: res.StatusCode,
  865. },
  866. }
  867. target := &ret
  868. if err := gensupport.DecodeResponse(target, res); err != nil {
  869. return nil, err
  870. }
  871. return ret, nil
  872. // {
  873. // "description": "Determines whether the specified (directional) relationship exists between\nthe specified source and target assets.\n\nThe relation describes the intent of the link between the two assets as\nclaimed by the source asset. An example for such relationships is the\ndelegation of privileges or permissions.\n\nThis command is most often used by infrastructure systems to check\npreconditions for an action. For example, a client may want to know if it\nis OK to send a web URL to a particular mobile app instead. The client can\ncheck for the relevant asset link from the website to the mobile app to\ndecide if the operation should be allowed.\n\nA note about security: if you specify a secure asset as the source, such as\nan HTTPS website or an Android app, the API will ensure that any\nstatements used to generate the response have been made in a secure way by\nthe owner of that asset. Conversely, if the source asset is an insecure\nHTTP website (that is, the URL starts with `http://` instead of `https://`),\nthe API cannot verify its statements securely, and it is not possible to\nensure that the website's statements have not been altered by a third\nparty. For more information, see the [Digital Asset Links technical design\nspecification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).",
  874. // "flatPath": "v1/assetlinks:check",
  875. // "httpMethod": "GET",
  876. // "id": "digitalassetlinks.assetlinks.check",
  877. // "parameterOrder": [],
  878. // "parameters": {
  879. // "relation": {
  880. // "description": "Query string for the relation.\n\nWe identify relations with strings of the format `\u003ckind\u003e/\u003cdetail\u003e`, where\n`\u003ckind\u003e` must be one of a set of pre-defined purpose categories, and\n`\u003cdetail\u003e` is a free-form lowercase alphanumeric string that describes the\nspecific use case of the statement.\n\nRefer to [our API documentation](/digital-asset-links/v1/relation-strings)\nfor the current list of supported relations.\n\nFor a query to match an asset link, both the query's and the asset link's\nrelation strings must match exactly.\n\nExample: A query with relation `delegate_permission/common.handle_all_urls`\nmatches an asset link with relation\n`delegate_permission/common.handle_all_urls`.",
  881. // "location": "query",
  882. // "type": "string"
  883. // },
  884. // "source.androidApp.certificate.sha256Fingerprint": {
  885. // "description": "The uppercase SHA-265 fingerprint of the certificate. From the PEM\n certificate, it can be acquired like this:\n\n $ keytool -printcert -file $CERTFILE | grep SHA256:\n SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \\\n 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nor like this:\n\n $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256\n SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \\\n 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nIn this example, the contents of this field would be `14:6D:E9:83:C5:73:\n06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:\n44:E5`.\n\nIf these tools are not available to you, you can convert the PEM\ncertificate into the DER format, compute the SHA-256 hash of that string\nand represent the result as a hexstring (that is, uppercase hexadecimal\nrepresentations of each octet, separated by colons).",
  886. // "location": "query",
  887. // "type": "string"
  888. // },
  889. // "source.androidApp.packageName": {
  890. // "description": "Android App assets are naturally identified by their Java package name.\nFor example, the Google Maps app uses the package name\n`com.google.android.apps.maps`.\nREQUIRED",
  891. // "location": "query",
  892. // "type": "string"
  893. // },
  894. // "source.web.site": {
  895. // "description": "Web assets are identified by a URL that contains only the scheme, hostname\nand port parts. The format is\n\n http[s]://\u003chostname\u003e[:\u003cport\u003e]\n\nHostnames must be fully qualified: they must end in a single period\n(\"`.`\").\n\nOnly the schemes \"http\" and \"https\" are currently allowed.\n\nPort numbers are given as a decimal number, and they must be omitted if the\nstandard port numbers are used: 80 for http and 443 for https.\n\nWe call this limited URL the \"site\". All URLs that share the same scheme,\nhostname and port are considered to be a part of the site and thus belong\nto the web asset.\n\nExample: the asset with the site `https://www.google.com` contains all\nthese URLs:\n\n * `https://www.google.com/`\n * `https://www.google.com:443/`\n * `https://www.google.com/foo`\n * `https://www.google.com/foo?bar`\n * `https://www.google.com/foo#bar`\n * `https://user@password:www.google.com/`\n\nBut it does not contain these URLs:\n\n * `http://www.google.com/` (wrong scheme)\n * `https://google.com/` (hostname does not match)\n * `https://www.google.com:444/` (port does not match)\nREQUIRED",
  896. // "location": "query",
  897. // "type": "string"
  898. // },
  899. // "target.androidApp.certificate.sha256Fingerprint": {
  900. // "description": "The uppercase SHA-265 fingerprint of the certificate. From the PEM\n certificate, it can be acquired like this:\n\n $ keytool -printcert -file $CERTFILE | grep SHA256:\n SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \\\n 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nor like this:\n\n $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256\n SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \\\n 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nIn this example, the contents of this field would be `14:6D:E9:83:C5:73:\n06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:\n44:E5`.\n\nIf these tools are not available to you, you can convert the PEM\ncertificate into the DER format, compute the SHA-256 hash of that string\nand represent the result as a hexstring (that is, uppercase hexadecimal\nrepresentations of each octet, separated by colons).",
  901. // "location": "query",
  902. // "type": "string"
  903. // },
  904. // "target.androidApp.packageName": {
  905. // "description": "Android App assets are naturally identified by their Java package name.\nFor example, the Google Maps app uses the package name\n`com.google.android.apps.maps`.\nREQUIRED",
  906. // "location": "query",
  907. // "type": "string"
  908. // },
  909. // "target.web.site": {
  910. // "description": "Web assets are identified by a URL that contains only the scheme, hostname\nand port parts. The format is\n\n http[s]://\u003chostname\u003e[:\u003cport\u003e]\n\nHostnames must be fully qualified: they must end in a single period\n(\"`.`\").\n\nOnly the schemes \"http\" and \"https\" are currently allowed.\n\nPort numbers are given as a decimal number, and they must be omitted if the\nstandard port numbers are used: 80 for http and 443 for https.\n\nWe call this limited URL the \"site\". All URLs that share the same scheme,\nhostname and port are considered to be a part of the site and thus belong\nto the web asset.\n\nExample: the asset with the site `https://www.google.com` contains all\nthese URLs:\n\n * `https://www.google.com/`\n * `https://www.google.com:443/`\n * `https://www.google.com/foo`\n * `https://www.google.com/foo?bar`\n * `https://www.google.com/foo#bar`\n * `https://user@password:www.google.com/`\n\nBut it does not contain these URLs:\n\n * `http://www.google.com/` (wrong scheme)\n * `https://google.com/` (hostname does not match)\n * `https://www.google.com:444/` (port does not match)\nREQUIRED",
  911. // "location": "query",
  912. // "type": "string"
  913. // }
  914. // },
  915. // "path": "v1/assetlinks:check",
  916. // "response": {
  917. // "$ref": "CheckResponse"
  918. // }
  919. // }
  920. }
  921. // method id "digitalassetlinks.statements.list":
  922. type StatementsListCall struct {
  923. s *Service
  924. urlParams_ gensupport.URLParams
  925. ifNoneMatch_ string
  926. ctx_ context.Context
  927. header_ http.Header
  928. }
  929. // List: Retrieves a list of all statements from a given source that
  930. // match the
  931. // specified target and statement string.
  932. //
  933. // The API guarantees that all statements with secure source assets,
  934. // such as
  935. // HTTPS websites or Android apps, have been made in a secure way by the
  936. // owner
  937. // of those assets, as described in the [Digital Asset Links technical
  938. // design
  939. // specification](https://github.com/google/digitalassetlinks/blob
  940. // /master/well-known/details.md).
  941. // Specifically, you should consider that for insecure websites (that
  942. // is,
  943. // where the URL starts with `http://` instead of `https://`), this
  944. // guarantee
  945. // cannot be made.
  946. //
  947. // The `List` command is most useful in cases where the API client wants
  948. // to
  949. // know all the ways in which two assets are related, or enumerate all
  950. // the
  951. // relationships from a particular source asset. Example: a feature
  952. // that
  953. // helps users navigate to related items. When a mobile app is running
  954. // on a
  955. // device, the feature would make it easy to navigate to the
  956. // corresponding web
  957. // site or Google+ profile.
  958. func (r *StatementsService) List() *StatementsListCall {
  959. c := &StatementsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  960. return c
  961. }
  962. // Relation sets the optional parameter "relation": Use only
  963. // associations that match the specified relation.
  964. //
  965. // See the [`Statement`](#Statement) message for a detailed definition
  966. // of
  967. // relation strings.
  968. //
  969. // For a query to match a statement, one of the following must be
  970. // true:
  971. //
  972. // * both the query's and the statement's relation strings match
  973. // exactly,
  974. // or
  975. // * the query's relation string is empty or missing.
  976. //
  977. // Example: A query with relation
  978. // `delegate_permission/common.handle_all_urls`
  979. // matches an asset link with
  980. // relation
  981. // `delegate_permission/common.handle_all_urls`.
  982. func (c *StatementsListCall) Relation(relation string) *StatementsListCall {
  983. c.urlParams_.Set("relation", relation)
  984. return c
  985. }
  986. // SourceAndroidAppCertificateSha256Fingerprint sets the optional
  987. // parameter "source.androidApp.certificate.sha256Fingerprint": The
  988. // uppercase SHA-265 fingerprint of the certificate. From the PEM
  989. // certificate, it can be acquired like this:
  990. //
  991. // $ keytool -printcert -file $CERTFILE | grep SHA256:
  992. // SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:
  993. // \
  994. // 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  995. //
  996. // or like this:
  997. //
  998. // $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256
  999. // SHA256
  1000. // Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \
  1001. // 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5
  1002. //
  1003. // In this example, the contents of this field would be
  1004. // `14:6D:E9:83:C5:73:
  1005. // 06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE
  1006. // :A8:8A:04:96:B2:3F:CF:
  1007. // 44:E5`.
  1008. //
  1009. // If these tools are not available to you, you can convert the
  1010. // PEM
  1011. // certificate into the DER format, compute the SHA-256 hash of that
  1012. // string
  1013. // and represent the result as a hexstring (that is, uppercase
  1014. // hexadecimal
  1015. // representations of each octet, separated by colons).
  1016. func (c *StatementsListCall) SourceAndroidAppCertificateSha256Fingerprint(sourceAndroidAppCertificateSha256Fingerprint string) *StatementsListCall {
  1017. c.urlParams_.Set("source.androidApp.certificate.sha256Fingerprint", sourceAndroidAppCertificateSha256Fingerprint)
  1018. return c
  1019. }
  1020. // SourceAndroidAppPackageName sets the optional parameter
  1021. // "source.androidApp.packageName": Android App assets are naturally
  1022. // identified by their Java package name.
  1023. // For example, the Google Maps app uses the package
  1024. // name
  1025. // `com.google.android.apps.maps`.
  1026. // REQUIRED
  1027. func (c *StatementsListCall) SourceAndroidAppPackageName(sourceAndroidAppPackageName string) *StatementsListCall {
  1028. c.urlParams_.Set("source.androidApp.packageName", sourceAndroidAppPackageName)
  1029. return c
  1030. }
  1031. // SourceWebSite sets the optional parameter "source.web.site": Web
  1032. // assets are identified by a URL that contains only the scheme,
  1033. // hostname
  1034. // and port parts. The format is
  1035. //
  1036. // http[s]://<hostname>[:<port>]
  1037. //
  1038. // Hostnames must be fully qualified: they must end in a single
  1039. // period
  1040. // (".").
  1041. //
  1042. // Only the schemes "http" and "https" are currently allowed.
  1043. //
  1044. // Port numbers are given as a decimal number, and they must be omitted
  1045. // if the
  1046. // standard port numbers are used: 80 for http and 443 for https.
  1047. //
  1048. // We call this limited URL the "site". All URLs that share the same
  1049. // scheme,
  1050. // hostname and port are considered to be a part of the site and thus
  1051. // belong
  1052. // to the web asset.
  1053. //
  1054. // Example: the asset with the site `https://www.google.com` contains
  1055. // all
  1056. // these URLs:
  1057. //
  1058. // * `https://www.google.com/`
  1059. // * `https://www.google.com:443/`
  1060. // * `https://www.google.com/foo`
  1061. // * `https://www.google.com/foo?bar`
  1062. // * `https://www.google.com/foo#bar`
  1063. // * `https://user@password:www.google.com/`
  1064. //
  1065. // But it does not contain these URLs:
  1066. //
  1067. // * `http://www.google.com/` (wrong scheme)
  1068. // * `https://google.com/` (hostname does not match)
  1069. // * `https://www.google.com:444/` (port does not match)
  1070. // REQUIRED
  1071. func (c *StatementsListCall) SourceWebSite(sourceWebSite string) *StatementsListCall {
  1072. c.urlParams_.Set("source.web.site", sourceWebSite)
  1073. return c
  1074. }
  1075. // Fields allows partial responses to be retrieved. See
  1076. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1077. // for more information.
  1078. func (c *StatementsListCall) Fields(s ...googleapi.Field) *StatementsListCall {
  1079. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1080. return c
  1081. }
  1082. // IfNoneMatch sets the optional parameter which makes the operation
  1083. // fail if the object's ETag matches the given value. This is useful for
  1084. // getting updates only after the object has changed since the last
  1085. // request. Use googleapi.IsNotModified to check whether the response
  1086. // error from Do is the result of In-None-Match.
  1087. func (c *StatementsListCall) IfNoneMatch(entityTag string) *StatementsListCall {
  1088. c.ifNoneMatch_ = entityTag
  1089. return c
  1090. }
  1091. // Context sets the context to be used in this call's Do method. Any
  1092. // pending HTTP request will be aborted if the provided context is
  1093. // canceled.
  1094. func (c *StatementsListCall) Context(ctx context.Context) *StatementsListCall {
  1095. c.ctx_ = ctx
  1096. return c
  1097. }
  1098. // Header returns an http.Header that can be modified by the caller to
  1099. // add HTTP headers to the request.
  1100. func (c *StatementsListCall) Header() http.Header {
  1101. if c.header_ == nil {
  1102. c.header_ = make(http.Header)
  1103. }
  1104. return c.header_
  1105. }
  1106. func (c *StatementsListCall) doRequest(alt string) (*http.Response, error) {
  1107. reqHeaders := make(http.Header)
  1108. for k, v := range c.header_ {
  1109. reqHeaders[k] = v
  1110. }
  1111. reqHeaders.Set("User-Agent", c.s.userAgent())
  1112. if c.ifNoneMatch_ != "" {
  1113. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1114. }
  1115. var body io.Reader = nil
  1116. c.urlParams_.Set("alt", alt)
  1117. c.urlParams_.Set("prettyPrint", "false")
  1118. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/statements:list")
  1119. urls += "?" + c.urlParams_.Encode()
  1120. req, err := http.NewRequest("GET", urls, body)
  1121. if err != nil {
  1122. return nil, err
  1123. }
  1124. req.Header = reqHeaders
  1125. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1126. }
  1127. // Do executes the "digitalassetlinks.statements.list" call.
  1128. // Exactly one of *ListResponse or error will be non-nil. Any non-2xx
  1129. // status code is an error. Response headers are in either
  1130. // *ListResponse.ServerResponse.Header or (if a response was returned at
  1131. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  1132. // to check whether the returned error was because
  1133. // http.StatusNotModified was returned.
  1134. func (c *StatementsListCall) Do(opts ...googleapi.CallOption) (*ListResponse, error) {
  1135. gensupport.SetOptions(c.urlParams_, opts...)
  1136. res, err := c.doRequest("json")
  1137. if res != nil && res.StatusCode == http.StatusNotModified {
  1138. if res.Body != nil {
  1139. res.Body.Close()
  1140. }
  1141. return nil, &googleapi.Error{
  1142. Code: res.StatusCode,
  1143. Header: res.Header,
  1144. }
  1145. }
  1146. if err != nil {
  1147. return nil, err
  1148. }
  1149. defer googleapi.CloseBody(res)
  1150. if err := googleapi.CheckResponse(res); err != nil {
  1151. return nil, err
  1152. }
  1153. ret := &ListResponse{
  1154. ServerResponse: googleapi.ServerResponse{
  1155. Header: res.Header,
  1156. HTTPStatusCode: res.StatusCode,
  1157. },
  1158. }
  1159. target := &ret
  1160. if err := gensupport.DecodeResponse(target, res); err != nil {
  1161. return nil, err
  1162. }
  1163. return ret, nil
  1164. // {
  1165. // "description": "Retrieves a list of all statements from a given source that match the\nspecified target and statement string.\n\nThe API guarantees that all statements with secure source assets, such as\nHTTPS websites or Android apps, have been made in a secure way by the owner\nof those assets, as described in the [Digital Asset Links technical design\nspecification](https://github.com/google/digitalassetlinks/blob/master/well-known/details.md).\nSpecifically, you should consider that for insecure websites (that is,\nwhere the URL starts with `http://` instead of `https://`), this guarantee\ncannot be made.\n\nThe `List` command is most useful in cases where the API client wants to\nknow all the ways in which two assets are related, or enumerate all the\nrelationships from a particular source asset. Example: a feature that\nhelps users navigate to related items. When a mobile app is running on a\ndevice, the feature would make it easy to navigate to the corresponding web\nsite or Google+ profile.",
  1166. // "flatPath": "v1/statements:list",
  1167. // "httpMethod": "GET",
  1168. // "id": "digitalassetlinks.statements.list",
  1169. // "parameterOrder": [],
  1170. // "parameters": {
  1171. // "relation": {
  1172. // "description": "Use only associations that match the specified relation.\n\nSee the [`Statement`](#Statement) message for a detailed definition of\nrelation strings.\n\nFor a query to match a statement, one of the following must be true:\n\n* both the query's and the statement's relation strings match exactly,\n or\n* the query's relation string is empty or missing.\n\nExample: A query with relation `delegate_permission/common.handle_all_urls`\nmatches an asset link with relation\n`delegate_permission/common.handle_all_urls`.",
  1173. // "location": "query",
  1174. // "type": "string"
  1175. // },
  1176. // "source.androidApp.certificate.sha256Fingerprint": {
  1177. // "description": "The uppercase SHA-265 fingerprint of the certificate. From the PEM\n certificate, it can be acquired like this:\n\n $ keytool -printcert -file $CERTFILE | grep SHA256:\n SHA256: 14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83: \\\n 42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nor like this:\n\n $ openssl x509 -in $CERTFILE -noout -fingerprint -sha256\n SHA256 Fingerprint=14:6D:E9:83:C5:73:06:50:D8:EE:B9:95:2F:34:FC:64: \\\n 16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:44:E5\n\nIn this example, the contents of this field would be `14:6D:E9:83:C5:73:\n06:50:D8:EE:B9:95:2F:34:FC:64:16:A0:83:42:E6:1D:BE:A8:8A:04:96:B2:3F:CF:\n44:E5`.\n\nIf these tools are not available to you, you can convert the PEM\ncertificate into the DER format, compute the SHA-256 hash of that string\nand represent the result as a hexstring (that is, uppercase hexadecimal\nrepresentations of each octet, separated by colons).",
  1178. // "location": "query",
  1179. // "type": "string"
  1180. // },
  1181. // "source.androidApp.packageName": {
  1182. // "description": "Android App assets are naturally identified by their Java package name.\nFor example, the Google Maps app uses the package name\n`com.google.android.apps.maps`.\nREQUIRED",
  1183. // "location": "query",
  1184. // "type": "string"
  1185. // },
  1186. // "source.web.site": {
  1187. // "description": "Web assets are identified by a URL that contains only the scheme, hostname\nand port parts. The format is\n\n http[s]://\u003chostname\u003e[:\u003cport\u003e]\n\nHostnames must be fully qualified: they must end in a single period\n(\"`.`\").\n\nOnly the schemes \"http\" and \"https\" are currently allowed.\n\nPort numbers are given as a decimal number, and they must be omitted if the\nstandard port numbers are used: 80 for http and 443 for https.\n\nWe call this limited URL the \"site\". All URLs that share the same scheme,\nhostname and port are considered to be a part of the site and thus belong\nto the web asset.\n\nExample: the asset with the site `https://www.google.com` contains all\nthese URLs:\n\n * `https://www.google.com/`\n * `https://www.google.com:443/`\n * `https://www.google.com/foo`\n * `https://www.google.com/foo?bar`\n * `https://www.google.com/foo#bar`\n * `https://user@password:www.google.com/`\n\nBut it does not contain these URLs:\n\n * `http://www.google.com/` (wrong scheme)\n * `https://google.com/` (hostname does not match)\n * `https://www.google.com:444/` (port does not match)\nREQUIRED",
  1188. // "location": "query",
  1189. // "type": "string"
  1190. // }
  1191. // },
  1192. // "path": "v1/statements:list",
  1193. // "response": {
  1194. // "$ref": "ListResponse"
  1195. // }
  1196. // }
  1197. }