...

Source file src/google.golang.org/api/playintegrity/v1/playintegrity-gen.go

Documentation: google.golang.org/api/playintegrity/v1

     1  // Copyright 2024 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  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package playintegrity provides access to the Google Play Integrity API.
     8  //
     9  // For product documentation, see: https://developer.android.com/google/play/integrity
    10  //
    11  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/playintegrity/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	playintegrityService, err := playintegrity.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // To use an API key for authentication (note: some APIs do not support API
    38  // keys), use [google.golang.org/api/option.WithAPIKey]:
    39  //
    40  //	playintegrityService, err := playintegrity.NewService(ctx, option.WithAPIKey("AIza..."))
    41  //
    42  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    43  // flow, use [google.golang.org/api/option.WithTokenSource]:
    44  //
    45  //	config := &oauth2.Config{...}
    46  //	// ...
    47  //	token, err := config.Exchange(ctx, ...)
    48  //	playintegrityService, err := playintegrity.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    49  //
    50  // See [google.golang.org/api/option.ClientOption] for details on options.
    51  package playintegrity // import "google.golang.org/api/playintegrity/v1"
    52  
    53  import (
    54  	"bytes"
    55  	"context"
    56  	"encoding/json"
    57  	"errors"
    58  	"fmt"
    59  	"io"
    60  	"net/http"
    61  	"net/url"
    62  	"strconv"
    63  	"strings"
    64  
    65  	googleapi "google.golang.org/api/googleapi"
    66  	internal "google.golang.org/api/internal"
    67  	gensupport "google.golang.org/api/internal/gensupport"
    68  	option "google.golang.org/api/option"
    69  	internaloption "google.golang.org/api/option/internaloption"
    70  	htransport "google.golang.org/api/transport/http"
    71  )
    72  
    73  // Always reference these packages, just in case the auto-generated code
    74  // below doesn't.
    75  var _ = bytes.NewBuffer
    76  var _ = strconv.Itoa
    77  var _ = fmt.Sprintf
    78  var _ = json.NewDecoder
    79  var _ = io.Copy
    80  var _ = url.Parse
    81  var _ = gensupport.MarshalJSON
    82  var _ = googleapi.Version
    83  var _ = errors.New
    84  var _ = strings.Replace
    85  var _ = context.Canceled
    86  var _ = internaloption.WithDefaultEndpoint
    87  var _ = internal.Version
    88  
    89  const apiId = "playintegrity:v1"
    90  const apiName = "playintegrity"
    91  const apiVersion = "v1"
    92  const basePath = "https://playintegrity.googleapis.com/"
    93  const basePathTemplate = "https://playintegrity.UNIVERSE_DOMAIN/"
    94  const mtlsBasePath = "https://playintegrity.mtls.googleapis.com/"
    95  
    96  // OAuth2 scopes used by this API.
    97  const (
    98  	// Private Service: https://www.googleapis.com/auth/playintegrity
    99  	PlayintegrityScope = "https://www.googleapis.com/auth/playintegrity"
   100  )
   101  
   102  // NewService creates a new Service.
   103  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   104  	scopesOption := internaloption.WithDefaultScopes(
   105  		"https://www.googleapis.com/auth/playintegrity",
   106  	)
   107  	// NOTE: prepend, so we don't override user-specified scopes.
   108  	opts = append([]option.ClientOption{scopesOption}, opts...)
   109  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   110  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   111  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   112  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   113  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   114  	if err != nil {
   115  		return nil, err
   116  	}
   117  	s, err := New(client)
   118  	if err != nil {
   119  		return nil, err
   120  	}
   121  	if endpoint != "" {
   122  		s.BasePath = endpoint
   123  	}
   124  	return s, nil
   125  }
   126  
   127  // New creates a new Service. It uses the provided http.Client for requests.
   128  //
   129  // Deprecated: please use NewService instead.
   130  // To provide a custom HTTP client, use option.WithHTTPClient.
   131  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   132  func New(client *http.Client) (*Service, error) {
   133  	if client == nil {
   134  		return nil, errors.New("client is nil")
   135  	}
   136  	s := &Service{client: client, BasePath: basePath}
   137  	s.V1 = NewV1Service(s)
   138  	return s, nil
   139  }
   140  
   141  type Service struct {
   142  	client    *http.Client
   143  	BasePath  string // API endpoint base URL
   144  	UserAgent string // optional additional User-Agent fragment
   145  
   146  	V1 *V1Service
   147  }
   148  
   149  func (s *Service) userAgent() string {
   150  	if s.UserAgent == "" {
   151  		return googleapi.UserAgent
   152  	}
   153  	return googleapi.UserAgent + " " + s.UserAgent
   154  }
   155  
   156  func NewV1Service(s *Service) *V1Service {
   157  	rs := &V1Service{s: s}
   158  	return rs
   159  }
   160  
   161  type V1Service struct {
   162  	s *Service
   163  }
   164  
   165  // AccountActivity: (Restricted Access) Contains a signal helping apps
   166  // differentiating between likely genuine and likely non-genuine user traffic.
   167  type AccountActivity struct {
   168  	// ActivityLevel: Required. Indicates the activity level of the account.
   169  	//
   170  	// Possible values:
   171  	//   "ACTIVITY_LEVEL_UNSPECIFIED" - Activity level has not been set.
   172  	//   "UNEVALUATED" - Account activity level is not evaluated.
   173  	//   "UNUSUAL" - Unusual activity for at least one of the user accounts on the
   174  	// device.
   175  	//   "UNKNOWN" - Insufficient activity to verify the user account on the
   176  	// device.
   177  	//   "TYPICAL_BASIC" - Typical activity for the user account or accounts on the
   178  	// device.
   179  	//   "TYPICAL_STRONG" - Typical for the user account or accounts on the device,
   180  	// with harder to replicate signals.
   181  	ActivityLevel string `json:"activityLevel,omitempty"`
   182  	// ForceSendFields is a list of field names (e.g. "ActivityLevel") to
   183  	// unconditionally include in API requests. By default, fields with empty or
   184  	// default values are omitted from API requests. See
   185  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   186  	// details.
   187  	ForceSendFields []string `json:"-"`
   188  	// NullFields is a list of field names (e.g. "ActivityLevel") to include in API
   189  	// requests with the JSON null value. By default, fields with empty values are
   190  	// omitted from API requests. See
   191  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   192  	NullFields []string `json:"-"`
   193  }
   194  
   195  func (s *AccountActivity) MarshalJSON() ([]byte, error) {
   196  	type NoMethod AccountActivity
   197  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   198  }
   199  
   200  // AccountDetails: Contains the account information such as the licensing
   201  // status for the user in the scope.
   202  type AccountDetails struct {
   203  	// AccountActivity: (Restricted Access) Details about the account activity for
   204  	// the user in the scope.
   205  	AccountActivity *AccountActivity `json:"accountActivity,omitempty"`
   206  	// AppLicensingVerdict: Required. Details about the licensing status of the
   207  	// user for the app in the scope.
   208  	//
   209  	// Possible values:
   210  	//   "UNKNOWN" - Play does not have sufficient information to evaluate
   211  	// licensing details
   212  	//   "LICENSED" - The app and certificate match the versions distributed by
   213  	// Play.
   214  	//   "UNLICENSED" - The certificate or package name does not match Google Play
   215  	// records.
   216  	//   "UNEVALUATED" - Licensing details were not evaluated since a necessary
   217  	// requirement was missed. For example DeviceIntegrity did not meet the minimum
   218  	// bar or the application was not a known Play version.
   219  	AppLicensingVerdict string `json:"appLicensingVerdict,omitempty"`
   220  	// ForceSendFields is a list of field names (e.g. "AccountActivity") to
   221  	// unconditionally include in API requests. By default, fields with empty or
   222  	// default values are omitted from API requests. See
   223  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   224  	// details.
   225  	ForceSendFields []string `json:"-"`
   226  	// NullFields is a list of field names (e.g. "AccountActivity") to include in
   227  	// API requests with the JSON null value. By default, fields with empty values
   228  	// are omitted from API requests. See
   229  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   230  	NullFields []string `json:"-"`
   231  }
   232  
   233  func (s *AccountDetails) MarshalJSON() ([]byte, error) {
   234  	type NoMethod AccountDetails
   235  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   236  }
   237  
   238  // AppAccessRiskVerdict: Contains signals about others apps on the device which
   239  // could be used to access or control the requesting app.
   240  type AppAccessRiskVerdict struct {
   241  	// AppsDetected: List of detected app types signalled for App Access Risk.
   242  	//
   243  	// Possible values:
   244  	//   "APPS_DETECTED_UNSPECIFIED" - Apps detected is unspecified.
   245  	//   "KNOWN_INSTALLED" - One or more apps is installed by Google Play or
   246  	// preloaded on the system partition by the device manufacturer.
   247  	//   "KNOWN_CAPTURING" - One or more apps installed by Google Play or preloaded
   248  	// on the device is running that could be used to read or capture the
   249  	// requesting app, such as a screen recording app.
   250  	//   "KNOWN_OVERLAYS" - One or more apps installed by Google Play or preloaded
   251  	// on the device is running that could be used to display overlays over the
   252  	// requesting app.
   253  	//   "KNOWN_CONTROLLING" - One or more apps installed by Google Play or
   254  	// preloaded on the device is running that could be used to control the device,
   255  	// such as a remote support app.
   256  	//   "UNKNOWN_INSTALLED" - One or more unknown apps is installed, that were not
   257  	// installed by Google Play or preloaded on the system partition by the device
   258  	// manufacturer.
   259  	//   "UNKNOWN_CAPTURING" - One or more unknown apps, which were not installed
   260  	// by Google Play or preloaded on the device, is running that could be used to
   261  	// read or capture the requesting app, such as a screen recording app.
   262  	//   "UNKNOWN_OVERLAYS" - One or more unknown apps, which were not installed by
   263  	// Google Play or preloaded on the device, is running that could be used to
   264  	// display overlays over the requesting app.
   265  	//   "UNKNOWN_CONTROLLING" - One or more unknown apps, which were not installed
   266  	// by Google Play or preloaded on the device, is running that could be used to
   267  	// control the device, such as a remote support app.
   268  	AppsDetected []string `json:"appsDetected,omitempty"`
   269  	// OtherApps: Deprecated: this field will be removed, please use apps_detected
   270  	// instead. App access risk verdict related to apps that are not installed by
   271  	// Google Play, and are not preloaded on the system image by the device
   272  	// manufacturer.
   273  	//
   274  	// Possible values:
   275  	//   "UNKNOWN" - Risk type is unknown.
   276  	//   "UNEVALUATED" - App access risk was not evaluated because a requirement
   277  	// was missed, such as the device not being trusted enough.
   278  	//   "NOT_INSTALLED" - No apps under this field are installed on the device.
   279  	// This is only valid for the other apps field.
   280  	//   "INSTALLED" - One or more apps under this field are installed on the
   281  	// device.
   282  	//   "CAPTURING" - Apps under this field are running that could be used to read
   283  	// or capture inputs and outputs of the requesting app, such as screen
   284  	// recording apps.
   285  	//   "CONTROLLING" - Apps under this field are running that could be used to
   286  	// control the device and inputs and outputs of the requesting app, such as
   287  	// remote controlling apps.
   288  	OtherApps string `json:"otherApps,omitempty"`
   289  	// PlayOrSystemApps: Deprecated: this field will be removed, please use
   290  	// apps_detected instead. App access risk verdict related to apps that are not
   291  	// installed by the Google Play Store, and are not preloaded on the system
   292  	// image by the device manufacturer.
   293  	//
   294  	// Possible values:
   295  	//   "UNKNOWN" - Risk type is unknown.
   296  	//   "UNEVALUATED" - App access risk was not evaluated because a requirement
   297  	// was missed, such as the device not being trusted enough.
   298  	//   "NOT_INSTALLED" - No apps under this field are installed on the device.
   299  	// This is only valid for the other apps field.
   300  	//   "INSTALLED" - One or more apps under this field are installed on the
   301  	// device.
   302  	//   "CAPTURING" - Apps under this field are running that could be used to read
   303  	// or capture inputs and outputs of the requesting app, such as screen
   304  	// recording apps.
   305  	//   "CONTROLLING" - Apps under this field are running that could be used to
   306  	// control the device and inputs and outputs of the requesting app, such as
   307  	// remote controlling apps.
   308  	PlayOrSystemApps string `json:"playOrSystemApps,omitempty"`
   309  	// ForceSendFields is a list of field names (e.g. "AppsDetected") to
   310  	// unconditionally include in API requests. By default, fields with empty or
   311  	// default values are omitted from API requests. See
   312  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   313  	// details.
   314  	ForceSendFields []string `json:"-"`
   315  	// NullFields is a list of field names (e.g. "AppsDetected") to include in API
   316  	// requests with the JSON null value. By default, fields with empty values are
   317  	// omitted from API requests. See
   318  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   319  	NullFields []string `json:"-"`
   320  }
   321  
   322  func (s *AppAccessRiskVerdict) MarshalJSON() ([]byte, error) {
   323  	type NoMethod AppAccessRiskVerdict
   324  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   325  }
   326  
   327  // AppIntegrity: Contains the application integrity information.
   328  type AppIntegrity struct {
   329  	// AppRecognitionVerdict: Required. Details about the app recognition verdict
   330  	//
   331  	// Possible values:
   332  	//   "UNKNOWN" - Play does not have sufficient information to evaluate app
   333  	// integrity
   334  	//   "PLAY_RECOGNIZED" - The app and certificate match the versions distributed
   335  	// by Play.
   336  	//   "UNRECOGNIZED_VERSION" - The certificate or package name does not match
   337  	// Google Play records.
   338  	//   "UNEVALUATED" - Application integrity was not evaluated since a necessary
   339  	// requirement was missed. For example DeviceIntegrity did not meet the minimum
   340  	// bar.
   341  	AppRecognitionVerdict string `json:"appRecognitionVerdict,omitempty"`
   342  	// CertificateSha256Digest: The SHA256 hash of the requesting app's signing
   343  	// certificates (base64 web-safe encoded). Set iff app_recognition_verdict !=
   344  	// UNEVALUATED.
   345  	CertificateSha256Digest []string `json:"certificateSha256Digest,omitempty"`
   346  	// PackageName: Package name of the application under attestation. Set iff
   347  	// app_recognition_verdict != UNEVALUATED.
   348  	PackageName string `json:"packageName,omitempty"`
   349  	// VersionCode: Version code of the application. Set iff
   350  	// app_recognition_verdict != UNEVALUATED.
   351  	VersionCode int64 `json:"versionCode,omitempty,string"`
   352  	// ForceSendFields is a list of field names (e.g. "AppRecognitionVerdict") to
   353  	// unconditionally include in API requests. By default, fields with empty or
   354  	// default values are omitted from API requests. See
   355  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   356  	// details.
   357  	ForceSendFields []string `json:"-"`
   358  	// NullFields is a list of field names (e.g. "AppRecognitionVerdict") to
   359  	// include in API requests with the JSON null value. By default, fields with
   360  	// empty values are omitted from API requests. See
   361  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   362  	NullFields []string `json:"-"`
   363  }
   364  
   365  func (s *AppIntegrity) MarshalJSON() ([]byte, error) {
   366  	type NoMethod AppIntegrity
   367  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   368  }
   369  
   370  // DecodeIntegrityTokenRequest: Request to decode the integrity token.
   371  type DecodeIntegrityTokenRequest struct {
   372  	// IntegrityToken: Encoded integrity token.
   373  	IntegrityToken string `json:"integrityToken,omitempty"`
   374  	// ForceSendFields is a list of field names (e.g. "IntegrityToken") to
   375  	// unconditionally include in API requests. By default, fields with empty or
   376  	// default values are omitted from API requests. See
   377  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   378  	// details.
   379  	ForceSendFields []string `json:"-"`
   380  	// NullFields is a list of field names (e.g. "IntegrityToken") to include in
   381  	// API requests with the JSON null value. By default, fields with empty values
   382  	// are omitted from API requests. See
   383  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   384  	NullFields []string `json:"-"`
   385  }
   386  
   387  func (s *DecodeIntegrityTokenRequest) MarshalJSON() ([]byte, error) {
   388  	type NoMethod DecodeIntegrityTokenRequest
   389  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   390  }
   391  
   392  // DecodeIntegrityTokenResponse: Response containing the decoded integrity
   393  // payload.
   394  type DecodeIntegrityTokenResponse struct {
   395  	// TokenPayloadExternal: Plain token payload generated from the decoded
   396  	// integrity token.
   397  	TokenPayloadExternal *TokenPayloadExternal `json:"tokenPayloadExternal,omitempty"`
   398  
   399  	// ServerResponse contains the HTTP response code and headers from the server.
   400  	googleapi.ServerResponse `json:"-"`
   401  	// ForceSendFields is a list of field names (e.g. "TokenPayloadExternal") to
   402  	// unconditionally include in API requests. By default, fields with empty or
   403  	// default values are omitted from API requests. See
   404  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   405  	// details.
   406  	ForceSendFields []string `json:"-"`
   407  	// NullFields is a list of field names (e.g. "TokenPayloadExternal") to include
   408  	// in API requests with the JSON null value. By default, fields with empty
   409  	// values are omitted from API requests. See
   410  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   411  	NullFields []string `json:"-"`
   412  }
   413  
   414  func (s *DecodeIntegrityTokenResponse) MarshalJSON() ([]byte, error) {
   415  	type NoMethod DecodeIntegrityTokenResponse
   416  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   417  }
   418  
   419  // DeviceIntegrity: Contains the device attestation information. Next tag: 4
   420  type DeviceIntegrity struct {
   421  	// DeviceRecognitionVerdict: Details about the integrity of the device the app
   422  	// is running on.
   423  	//
   424  	// Possible values:
   425  	//   "UNKNOWN" - Play does not have sufficient information to evaluate device
   426  	// integrity
   427  	//   "MEETS_BASIC_INTEGRITY" - App is running on a device that passes basic
   428  	// system integrity checks, but may not meet Android platform compatibility
   429  	// requirements and may not be approved to run Google Play services.
   430  	//   "MEETS_DEVICE_INTEGRITY" - App is running on GMS Android device with
   431  	// Google Play services.
   432  	//   "MEETS_STRONG_INTEGRITY" - App is running on GMS Android device with
   433  	// Google Play services and has a strong guarantee of system integrity such as
   434  	// a hardware-backed keystore.
   435  	//   "MEETS_VIRTUAL_INTEGRITY" - App is running on an Android emulator with
   436  	// Google Play services which meets core Android compatibility requirements.
   437  	DeviceRecognitionVerdict []string `json:"deviceRecognitionVerdict,omitempty"`
   438  	// RecentDeviceActivity: Details about the device activity of the device the
   439  	// app is running on.
   440  	RecentDeviceActivity *RecentDeviceActivity `json:"recentDeviceActivity,omitempty"`
   441  	// ForceSendFields is a list of field names (e.g. "DeviceRecognitionVerdict")
   442  	// to unconditionally include in API requests. By default, fields with empty or
   443  	// default values are omitted from API requests. See
   444  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   445  	// details.
   446  	ForceSendFields []string `json:"-"`
   447  	// NullFields is a list of field names (e.g. "DeviceRecognitionVerdict") to
   448  	// include in API requests with the JSON null value. By default, fields with
   449  	// empty values are omitted from API requests. See
   450  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   451  	NullFields []string `json:"-"`
   452  }
   453  
   454  func (s *DeviceIntegrity) MarshalJSON() ([]byte, error) {
   455  	type NoMethod DeviceIntegrity
   456  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   457  }
   458  
   459  // EnvironmentDetails: Contains information about the environment Play
   460  // Integrity API runs in, e.g. Play Protect verdict.
   461  type EnvironmentDetails struct {
   462  	// AppAccessRiskVerdict: The evaluation of the App Access Risk verdicts.
   463  	AppAccessRiskVerdict *AppAccessRiskVerdict `json:"appAccessRiskVerdict,omitempty"`
   464  	// PlayProtectVerdict: The evaluation of Play Protect verdict.
   465  	//
   466  	// Possible values:
   467  	//   "PLAY_PROTECT_VERDICT_UNSPECIFIED" - Play Protect verdict has not been
   468  	// set.
   469  	//   "UNEVALUATED" - Play Protect state was not evaluated. Device may not be
   470  	// trusted.
   471  	//   "NO_ISSUES" - Play Protect is on and no issues found.
   472  	//   "NO_DATA" - Play Protect is on but no scan has been performed yet. The
   473  	// device or Play Store app may have been reset.
   474  	//   "MEDIUM_RISK" - Play Protect is on and warnings found.
   475  	//   "HIGH_RISK" - Play Protect is on and high severity issues found.
   476  	//   "POSSIBLE_RISK" - Play Protect is turned off. Turn on Play Protect.
   477  	PlayProtectVerdict string `json:"playProtectVerdict,omitempty"`
   478  	// ForceSendFields is a list of field names (e.g. "AppAccessRiskVerdict") to
   479  	// unconditionally include in API requests. By default, fields with empty or
   480  	// default values are omitted from API requests. See
   481  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   482  	// details.
   483  	ForceSendFields []string `json:"-"`
   484  	// NullFields is a list of field names (e.g. "AppAccessRiskVerdict") to include
   485  	// in API requests with the JSON null value. By default, fields with empty
   486  	// values are omitted from API requests. See
   487  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   488  	NullFields []string `json:"-"`
   489  }
   490  
   491  func (s *EnvironmentDetails) MarshalJSON() ([]byte, error) {
   492  	type NoMethod EnvironmentDetails
   493  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   494  }
   495  
   496  // RecentDeviceActivity: Recent device activity can help developers identify
   497  // devices that have exhibited hyperactive attestation activity, which could be
   498  // a sign of an attack or token farming.
   499  type RecentDeviceActivity struct {
   500  	// DeviceActivityLevel: Required. Indicates the activity level of the device.
   501  	//
   502  	// Possible values:
   503  	//   "DEVICE_ACTIVITY_LEVEL_UNSPECIFIED" - Device activity level has not been
   504  	// set.
   505  	//   "UNEVALUATED" - Device activity level has not been evaluated.
   506  	//   "LEVEL_1" - Indicates the amount of used tokens. See the documentation for
   507  	// details.
   508  	//   "LEVEL_2" - Indicates the amount of used tokens. See the documentation for
   509  	// details.
   510  	//   "LEVEL_3" - Indicates the amount of used tokens. See the documentation for
   511  	// details.
   512  	//   "LEVEL_4" - Indicates the amount of used tokens. See the documentation for
   513  	// details.
   514  	DeviceActivityLevel string `json:"deviceActivityLevel,omitempty"`
   515  	// ForceSendFields is a list of field names (e.g. "DeviceActivityLevel") to
   516  	// unconditionally include in API requests. By default, fields with empty or
   517  	// default values are omitted from API requests. See
   518  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   519  	// details.
   520  	ForceSendFields []string `json:"-"`
   521  	// NullFields is a list of field names (e.g. "DeviceActivityLevel") to include
   522  	// in API requests with the JSON null value. By default, fields with empty
   523  	// values are omitted from API requests. See
   524  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   525  	NullFields []string `json:"-"`
   526  }
   527  
   528  func (s *RecentDeviceActivity) MarshalJSON() ([]byte, error) {
   529  	type NoMethod RecentDeviceActivity
   530  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   531  }
   532  
   533  // RequestDetails: Contains the integrity request information.
   534  type RequestDetails struct {
   535  	// Nonce: Nonce that was provided in the request (which is base64 web-safe
   536  	// no-wrap).
   537  	Nonce string `json:"nonce,omitempty"`
   538  	// RequestHash: Request hash that was provided in the request.
   539  	RequestHash string `json:"requestHash,omitempty"`
   540  	// RequestPackageName: Required. Application package name this attestation was
   541  	// requested for. Note: This field makes no guarantees or promises on the
   542  	// caller integrity. For details on application integrity, check
   543  	// application_integrity.
   544  	RequestPackageName string `json:"requestPackageName,omitempty"`
   545  	// TimestampMillis: Required. Timestamp, in milliseconds, of the integrity
   546  	// application request.
   547  	TimestampMillis int64 `json:"timestampMillis,omitempty,string"`
   548  	// ForceSendFields is a list of field names (e.g. "Nonce") to unconditionally
   549  	// include in API requests. By default, fields with empty or default values are
   550  	// omitted from API requests. See
   551  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   552  	// details.
   553  	ForceSendFields []string `json:"-"`
   554  	// NullFields is a list of field names (e.g. "Nonce") to include in API
   555  	// requests with the JSON null value. By default, fields with empty values are
   556  	// omitted from API requests. See
   557  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   558  	NullFields []string `json:"-"`
   559  }
   560  
   561  func (s *RequestDetails) MarshalJSON() ([]byte, error) {
   562  	type NoMethod RequestDetails
   563  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   564  }
   565  
   566  // TestingDetails: Contains additional information generated for testing
   567  // responses.
   568  type TestingDetails struct {
   569  	// IsTestingResponse: Required. Indicates that the information contained in
   570  	// this payload is a testing response that is statically overridden for a
   571  	// tester.
   572  	IsTestingResponse bool `json:"isTestingResponse,omitempty"`
   573  	// ForceSendFields is a list of field names (e.g. "IsTestingResponse") to
   574  	// unconditionally include in API requests. By default, fields with empty or
   575  	// default values are omitted from API requests. See
   576  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   577  	// details.
   578  	ForceSendFields []string `json:"-"`
   579  	// NullFields is a list of field names (e.g. "IsTestingResponse") to include in
   580  	// API requests with the JSON null value. By default, fields with empty values
   581  	// are omitted from API requests. See
   582  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   583  	NullFields []string `json:"-"`
   584  }
   585  
   586  func (s *TestingDetails) MarshalJSON() ([]byte, error) {
   587  	type NoMethod TestingDetails
   588  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   589  }
   590  
   591  // TokenPayloadExternal: Contains basic app information and integrity signals
   592  // like device attestation and licensing details.
   593  type TokenPayloadExternal struct {
   594  	// AccountDetails: Required. Details about the Play Store account.
   595  	AccountDetails *AccountDetails `json:"accountDetails,omitempty"`
   596  	// AppIntegrity: Required. Details about the application integrity.
   597  	AppIntegrity *AppIntegrity `json:"appIntegrity,omitempty"`
   598  	// DeviceIntegrity: Required. Details about the device integrity.
   599  	DeviceIntegrity *DeviceIntegrity `json:"deviceIntegrity,omitempty"`
   600  	// EnvironmentDetails: Details of the environment Play Integrity API runs in.
   601  	EnvironmentDetails *EnvironmentDetails `json:"environmentDetails,omitempty"`
   602  	// RequestDetails: Required. Details about the integrity request.
   603  	RequestDetails *RequestDetails `json:"requestDetails,omitempty"`
   604  	// TestingDetails: Indicates that this payload is generated for testing
   605  	// purposes and contains any additional data that is linked with testing
   606  	// status.
   607  	TestingDetails *TestingDetails `json:"testingDetails,omitempty"`
   608  	// ForceSendFields is a list of field names (e.g. "AccountDetails") to
   609  	// unconditionally include in API requests. By default, fields with empty or
   610  	// default values are omitted from API requests. See
   611  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   612  	// details.
   613  	ForceSendFields []string `json:"-"`
   614  	// NullFields is a list of field names (e.g. "AccountDetails") to include in
   615  	// API requests with the JSON null value. By default, fields with empty values
   616  	// are omitted from API requests. See
   617  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   618  	NullFields []string `json:"-"`
   619  }
   620  
   621  func (s *TokenPayloadExternal) MarshalJSON() ([]byte, error) {
   622  	type NoMethod TokenPayloadExternal
   623  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   624  }
   625  
   626  type V1DecodeIntegrityTokenCall struct {
   627  	s                           *Service
   628  	packageName                 string
   629  	decodeintegritytokenrequest *DecodeIntegrityTokenRequest
   630  	urlParams_                  gensupport.URLParams
   631  	ctx_                        context.Context
   632  	header_                     http.Header
   633  }
   634  
   635  // DecodeIntegrityToken: Decodes the integrity token and returns the token
   636  // payload.
   637  //
   638  //   - packageName: Package name of the app the attached integrity token belongs
   639  //     to.
   640  func (r *V1Service) DecodeIntegrityToken(packageName string, decodeintegritytokenrequest *DecodeIntegrityTokenRequest) *V1DecodeIntegrityTokenCall {
   641  	c := &V1DecodeIntegrityTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)}
   642  	c.packageName = packageName
   643  	c.decodeintegritytokenrequest = decodeintegritytokenrequest
   644  	return c
   645  }
   646  
   647  // Fields allows partial responses to be retrieved. See
   648  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
   649  // details.
   650  func (c *V1DecodeIntegrityTokenCall) Fields(s ...googleapi.Field) *V1DecodeIntegrityTokenCall {
   651  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
   652  	return c
   653  }
   654  
   655  // Context sets the context to be used in this call's Do method.
   656  func (c *V1DecodeIntegrityTokenCall) Context(ctx context.Context) *V1DecodeIntegrityTokenCall {
   657  	c.ctx_ = ctx
   658  	return c
   659  }
   660  
   661  // Header returns a http.Header that can be modified by the caller to add
   662  // headers to the request.
   663  func (c *V1DecodeIntegrityTokenCall) Header() http.Header {
   664  	if c.header_ == nil {
   665  		c.header_ = make(http.Header)
   666  	}
   667  	return c.header_
   668  }
   669  
   670  func (c *V1DecodeIntegrityTokenCall) doRequest(alt string) (*http.Response, error) {
   671  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
   672  	var body io.Reader = nil
   673  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.decodeintegritytokenrequest)
   674  	if err != nil {
   675  		return nil, err
   676  	}
   677  	c.urlParams_.Set("alt", alt)
   678  	c.urlParams_.Set("prettyPrint", "false")
   679  	urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+packageName}:decodeIntegrityToken")
   680  	urls += "?" + c.urlParams_.Encode()
   681  	req, err := http.NewRequest("POST", urls, body)
   682  	if err != nil {
   683  		return nil, err
   684  	}
   685  	req.Header = reqHeaders
   686  	googleapi.Expand(req.URL, map[string]string{
   687  		"packageName": c.packageName,
   688  	})
   689  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
   690  }
   691  
   692  // Do executes the "playintegrity.decodeIntegrityToken" call.
   693  // Any non-2xx status code is an error. Response headers are in either
   694  // *DecodeIntegrityTokenResponse.ServerResponse.Header or (if a response was
   695  // returned at all) in error.(*googleapi.Error).Header. Use
   696  // googleapi.IsNotModified to check whether the returned error was because
   697  // http.StatusNotModified was returned.
   698  func (c *V1DecodeIntegrityTokenCall) Do(opts ...googleapi.CallOption) (*DecodeIntegrityTokenResponse, error) {
   699  	gensupport.SetOptions(c.urlParams_, opts...)
   700  	res, err := c.doRequest("json")
   701  	if res != nil && res.StatusCode == http.StatusNotModified {
   702  		if res.Body != nil {
   703  			res.Body.Close()
   704  		}
   705  		return nil, gensupport.WrapError(&googleapi.Error{
   706  			Code:   res.StatusCode,
   707  			Header: res.Header,
   708  		})
   709  	}
   710  	if err != nil {
   711  		return nil, err
   712  	}
   713  	defer googleapi.CloseBody(res)
   714  	if err := googleapi.CheckResponse(res); err != nil {
   715  		return nil, gensupport.WrapError(err)
   716  	}
   717  	ret := &DecodeIntegrityTokenResponse{
   718  		ServerResponse: googleapi.ServerResponse{
   719  			Header:         res.Header,
   720  			HTTPStatusCode: res.StatusCode,
   721  		},
   722  	}
   723  	target := &ret
   724  	if err := gensupport.DecodeResponse(target, res); err != nil {
   725  		return nil, err
   726  	}
   727  	return ret, nil
   728  }
   729  

View as plain text