pwa.go 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. // Package pwa provides the Chrome DevTools Protocol
  2. // commands, types, and events for the PWA domain.
  3. //
  4. // This domain allows interacting with the browser to control PWAs.
  5. //
  6. // Generated by the cdproto-gen command.
  7. package pwa
  8. // Code generated by cdproto-gen. DO NOT EDIT.
  9. import (
  10. "context"
  11. "github.com/chromedp/cdproto/cdp"
  12. )
  13. // GetOsAppStateParams returns the following OS state for the given manifest
  14. // id.
  15. type GetOsAppStateParams struct {
  16. ManifestID string `json:"manifestId"` // The id from the webapp's manifest file, commonly it's the url of the site installing the webapp. See https://web.dev/learn/pwa/web-app-manifest.
  17. }
  18. // GetOsAppState returns the following OS state for the given manifest id.
  19. //
  20. // See: https://chromedevtools.github.io/devtools-protocol/tot/PWA#method-getOsAppState
  21. //
  22. // parameters:
  23. //
  24. // manifestID - The id from the webapp's manifest file, commonly it's the url of the site installing the webapp. See https://web.dev/learn/pwa/web-app-manifest.
  25. func GetOsAppState(manifestID string) *GetOsAppStateParams {
  26. return &GetOsAppStateParams{
  27. ManifestID: manifestID,
  28. }
  29. }
  30. // GetOsAppStateReturns return values.
  31. type GetOsAppStateReturns struct {
  32. BadgeCount int64 `json:"badgeCount,omitempty"`
  33. FileHandlers []*FileHandler `json:"fileHandlers,omitempty"`
  34. }
  35. // Do executes PWA.getOsAppState against the provided context.
  36. //
  37. // returns:
  38. //
  39. // badgeCount
  40. // fileHandlers
  41. func (p *GetOsAppStateParams) Do(ctx context.Context) (badgeCount int64, fileHandlers []*FileHandler, err error) {
  42. // execute
  43. var res GetOsAppStateReturns
  44. err = cdp.Execute(ctx, CommandGetOsAppState, p, &res)
  45. if err != nil {
  46. return 0, nil, err
  47. }
  48. return res.BadgeCount, res.FileHandlers, nil
  49. }
  50. // Command names.
  51. const (
  52. CommandGetOsAppState = "PWA.getOsAppState"
  53. )