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.
 
 
 

1227 lines
52 KiB

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