Não pode escolher mais do que 25 tópicos Os tópicos devem começar com uma letra ou um número, podem incluir traços ('-') e podem ter até 35 caracteres.
 
 
 

4303 linhas
160 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package proximitybeacon provides access to the Proximity Beacon API.
  6. //
  7. // For product documentation, see: https://developers.google.com/beacons/proximity/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/proximitybeacon/v1beta1"
  14. // ...
  15. // ctx := context.Background()
  16. // proximitybeaconService, err := proximitybeacon.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  25. //
  26. // proximitybeaconService, err := proximitybeacon.NewService(ctx, option.WithAPIKey("AIza..."))
  27. //
  28. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  29. //
  30. // config := &oauth2.Config{...}
  31. // // ...
  32. // token, err := config.Exchange(ctx, ...)
  33. // proximitybeaconService, err := proximitybeacon.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  34. //
  35. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  36. package proximitybeacon // import "google.golang.org/api/proximitybeacon/v1beta1"
  37. import (
  38. "bytes"
  39. "context"
  40. "encoding/json"
  41. "errors"
  42. "fmt"
  43. "io"
  44. "net/http"
  45. "net/url"
  46. "strconv"
  47. "strings"
  48. gensupport "google.golang.org/api/gensupport"
  49. googleapi "google.golang.org/api/googleapi"
  50. option "google.golang.org/api/option"
  51. htransport "google.golang.org/api/transport/http"
  52. )
  53. // Always reference these packages, just in case the auto-generated code
  54. // below doesn't.
  55. var _ = bytes.NewBuffer
  56. var _ = strconv.Itoa
  57. var _ = fmt.Sprintf
  58. var _ = json.NewDecoder
  59. var _ = io.Copy
  60. var _ = url.Parse
  61. var _ = gensupport.MarshalJSON
  62. var _ = googleapi.Version
  63. var _ = errors.New
  64. var _ = strings.Replace
  65. var _ = context.Canceled
  66. const apiId = "proximitybeacon:v1beta1"
  67. const apiName = "proximitybeacon"
  68. const apiVersion = "v1beta1"
  69. const basePath = "https://proximitybeacon.googleapis.com/"
  70. // OAuth2 scopes used by this API.
  71. const (
  72. // View and modify your beacons
  73. UserlocationBeaconRegistryScope = "https://www.googleapis.com/auth/userlocation.beacon.registry"
  74. )
  75. // NewService creates a new Service.
  76. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  77. scopesOption := option.WithScopes(
  78. "https://www.googleapis.com/auth/userlocation.beacon.registry",
  79. )
  80. // NOTE: prepend, so we don't override user-specified scopes.
  81. opts = append([]option.ClientOption{scopesOption}, opts...)
  82. client, endpoint, err := htransport.NewClient(ctx, opts...)
  83. if err != nil {
  84. return nil, err
  85. }
  86. s, err := New(client)
  87. if err != nil {
  88. return nil, err
  89. }
  90. if endpoint != "" {
  91. s.BasePath = endpoint
  92. }
  93. return s, nil
  94. }
  95. // New creates a new Service. It uses the provided http.Client for requests.
  96. //
  97. // Deprecated: please use NewService instead.
  98. // To provide a custom HTTP client, use option.WithHTTPClient.
  99. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  100. func New(client *http.Client) (*Service, error) {
  101. if client == nil {
  102. return nil, errors.New("client is nil")
  103. }
  104. s := &Service{client: client, BasePath: basePath}
  105. s.Beaconinfo = NewBeaconinfoService(s)
  106. s.Beacons = NewBeaconsService(s)
  107. s.Namespaces = NewNamespacesService(s)
  108. s.V1beta1 = NewV1beta1Service(s)
  109. return s, nil
  110. }
  111. type Service struct {
  112. client *http.Client
  113. BasePath string // API endpoint base URL
  114. UserAgent string // optional additional User-Agent fragment
  115. Beaconinfo *BeaconinfoService
  116. Beacons *BeaconsService
  117. Namespaces *NamespacesService
  118. V1beta1 *V1beta1Service
  119. }
  120. func (s *Service) userAgent() string {
  121. if s.UserAgent == "" {
  122. return googleapi.UserAgent
  123. }
  124. return googleapi.UserAgent + " " + s.UserAgent
  125. }
  126. func NewBeaconinfoService(s *Service) *BeaconinfoService {
  127. rs := &BeaconinfoService{s: s}
  128. return rs
  129. }
  130. type BeaconinfoService struct {
  131. s *Service
  132. }
  133. func NewBeaconsService(s *Service) *BeaconsService {
  134. rs := &BeaconsService{s: s}
  135. rs.Attachments = NewBeaconsAttachmentsService(s)
  136. rs.Diagnostics = NewBeaconsDiagnosticsService(s)
  137. return rs
  138. }
  139. type BeaconsService struct {
  140. s *Service
  141. Attachments *BeaconsAttachmentsService
  142. Diagnostics *BeaconsDiagnosticsService
  143. }
  144. func NewBeaconsAttachmentsService(s *Service) *BeaconsAttachmentsService {
  145. rs := &BeaconsAttachmentsService{s: s}
  146. return rs
  147. }
  148. type BeaconsAttachmentsService struct {
  149. s *Service
  150. }
  151. func NewBeaconsDiagnosticsService(s *Service) *BeaconsDiagnosticsService {
  152. rs := &BeaconsDiagnosticsService{s: s}
  153. return rs
  154. }
  155. type BeaconsDiagnosticsService struct {
  156. s *Service
  157. }
  158. func NewNamespacesService(s *Service) *NamespacesService {
  159. rs := &NamespacesService{s: s}
  160. return rs
  161. }
  162. type NamespacesService struct {
  163. s *Service
  164. }
  165. func NewV1beta1Service(s *Service) *V1beta1Service {
  166. rs := &V1beta1Service{s: s}
  167. return rs
  168. }
  169. type V1beta1Service struct {
  170. s *Service
  171. }
  172. // AdvertisedId: Defines a unique identifier of a beacon as broadcast by
  173. // the device.
  174. type AdvertisedId struct {
  175. // Id: The actual beacon identifier, as broadcast by the beacon
  176. // hardware. Must
  177. // be
  178. // [base64](http://tools.ietf.org/html/rfc4648#section-4) encoded in
  179. // HTTP
  180. // requests, and will be so encoded (with padding) in responses. The
  181. // base64
  182. // encoding should be of the binary byte-stream and not any textual
  183. // (such as
  184. // hex) representation thereof.
  185. // Required.
  186. Id string `json:"id,omitempty"`
  187. // Type: Specifies the identifier type.
  188. // Required.
  189. //
  190. // Possible values:
  191. // "TYPE_UNSPECIFIED" - Do not use this value.
  192. // "EDDYSTONE" - Eddystone, an open beacon format that supports
  193. // Android and iOS
  194. // devices
  195. // https://github.com/google/eddystone/wiki/Beacon-Specification
  196. // "IBEACON" - Apple iBeacon compatible beacon
  197. // "ALTBEACON" - See http://altbeacon.org and/or
  198. // https://github.com/AltBeacon/spec.
  199. // "EDDYSTONE_EID" - Eddystone Ephemeral ID
  200. Type string `json:"type,omitempty"`
  201. // ForceSendFields is a list of field names (e.g. "Id") to
  202. // unconditionally include in API requests. By default, fields with
  203. // empty values are omitted from API requests. However, any non-pointer,
  204. // non-interface field appearing in ForceSendFields will be sent to the
  205. // server regardless of whether the field is empty or not. This may be
  206. // used to include empty fields in Patch requests.
  207. ForceSendFields []string `json:"-"`
  208. // NullFields is a list of field names (e.g. "Id") to include in API
  209. // requests with the JSON null value. By default, fields with empty
  210. // values are omitted from API requests. However, any field with an
  211. // empty value appearing in NullFields will be sent to the server as
  212. // null. It is an error if a field in this list has a non-empty value.
  213. // This may be used to include null fields in Patch requests.
  214. NullFields []string `json:"-"`
  215. }
  216. func (s *AdvertisedId) MarshalJSON() ([]byte, error) {
  217. type NoMethod AdvertisedId
  218. raw := NoMethod(*s)
  219. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  220. }
  221. // AttachmentInfo: A subset of attachment information served via
  222. // the
  223. // `beaconinfo.getforobserved` method, used when your users encounter
  224. // your
  225. // beacons.
  226. type AttachmentInfo struct {
  227. // Data: An opaque data container for client-provided data.
  228. Data string `json:"data,omitempty"`
  229. // MaxDistanceMeters: The distance away from the beacon at which this
  230. // attachment should be
  231. // delivered to a mobile app.
  232. //
  233. // Setting this to a value greater than zero indicates that the app
  234. // should
  235. // behave as if the beacon is "seen" when the mobile device is less than
  236. // this
  237. // distance away from the beacon.
  238. //
  239. // Different attachments on the same beacon can have different max
  240. // distances.
  241. //
  242. // Note that even though this value is expressed with fractional
  243. // meter
  244. // precision, real-world behavior is likley to be much less precise than
  245. // one
  246. // meter, due to the nature of current Bluetooth radio
  247. // technology.
  248. //
  249. // Optional. When not set or zero, the attachment should be delivered at
  250. // the
  251. // beacon's outer limit of detection.
  252. MaxDistanceMeters float64 `json:"maxDistanceMeters,omitempty"`
  253. // NamespacedType: Specifies what kind of attachment this is. Tells a
  254. // client how to
  255. // interpret the `data` field. Format is <var>namespace/type</var>,
  256. // for
  257. // example <code>scrupulous-wombat-12345/welcome-message</code>
  258. NamespacedType string `json:"namespacedType,omitempty"`
  259. // ForceSendFields is a list of field names (e.g. "Data") to
  260. // unconditionally include in API requests. By default, fields with
  261. // empty values are omitted from API requests. However, any non-pointer,
  262. // non-interface field appearing in ForceSendFields will be sent to the
  263. // server regardless of whether the field is empty or not. This may be
  264. // used to include empty fields in Patch requests.
  265. ForceSendFields []string `json:"-"`
  266. // NullFields is a list of field names (e.g. "Data") to include in API
  267. // requests with the JSON null value. By default, fields with empty
  268. // values are omitted from API requests. However, any field with an
  269. // empty value appearing in NullFields will be sent to the server as
  270. // null. It is an error if a field in this list has a non-empty value.
  271. // This may be used to include null fields in Patch requests.
  272. NullFields []string `json:"-"`
  273. }
  274. func (s *AttachmentInfo) MarshalJSON() ([]byte, error) {
  275. type NoMethod AttachmentInfo
  276. raw := NoMethod(*s)
  277. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  278. }
  279. func (s *AttachmentInfo) UnmarshalJSON(data []byte) error {
  280. type NoMethod AttachmentInfo
  281. var s1 struct {
  282. MaxDistanceMeters gensupport.JSONFloat64 `json:"maxDistanceMeters"`
  283. *NoMethod
  284. }
  285. s1.NoMethod = (*NoMethod)(s)
  286. if err := json.Unmarshal(data, &s1); err != nil {
  287. return err
  288. }
  289. s.MaxDistanceMeters = float64(s1.MaxDistanceMeters)
  290. return nil
  291. }
  292. // Beacon: Details of a beacon device.
  293. type Beacon struct {
  294. // AdvertisedId: The identifier of a beacon as advertised by it. This
  295. // field must be
  296. // populated when registering. It may be empty when updating a
  297. // beacon
  298. // record because it is ignored in updates.
  299. //
  300. // When registering a beacon that broadcasts Eddystone-EID, this
  301. // field
  302. // should contain a "stable" Eddystone-UID that identifies the beacon
  303. // and
  304. // links it to its attachments. The stable Eddystone-UID is only used
  305. // for
  306. // administering the beacon.
  307. AdvertisedId *AdvertisedId `json:"advertisedId,omitempty"`
  308. // BeaconName: Resource name of this beacon. A beacon name has the
  309. // format
  310. // "beacons/N!beaconId" where the beaconId is the base16 ID broadcast
  311. // by
  312. // the beacon and N is a code for the beacon's type. Possible values
  313. // are
  314. // `3` for Eddystone, `1` for iBeacon, or `5` for AltBeacon.
  315. //
  316. // This field must be left empty when registering. After reading a
  317. // beacon,
  318. // clients can use the name for future operations.
  319. BeaconName string `json:"beaconName,omitempty"`
  320. // Description: Free text used to identify and describe the beacon.
  321. // Maximum length 140
  322. // characters.
  323. // Optional.
  324. Description string `json:"description,omitempty"`
  325. // EphemeralIdRegistration: Write-only registration parameters for
  326. // beacons using Eddystone-EID
  327. // (remotely resolved ephemeral ID) format. This information will not
  328. // be
  329. // populated in API responses. When submitting this data, the
  330. // `advertised_id`
  331. // field must contain an ID of type Eddystone-UID. Any other ID type
  332. // will
  333. // result in an error.
  334. EphemeralIdRegistration *EphemeralIdRegistration `json:"ephemeralIdRegistration,omitempty"`
  335. // ExpectedStability: Expected location stability. This is set when the
  336. // beacon is registered or
  337. // updated, not automatically detected in any way.
  338. // Optional.
  339. //
  340. // Possible values:
  341. // "STABILITY_UNSPECIFIED" - Do not use this value.
  342. // "STABLE" - Not expected to move, for example a store's front door.
  343. // "PORTABLE" - Usually stable but may move rarely, usually within a
  344. // single place,
  345. // for example a store display.
  346. // "MOBILE" - Moves frequently, for example a personal item or food
  347. // truck.
  348. // "ROVING" - Moves continuously in service, for example a bus or
  349. // train.
  350. ExpectedStability string `json:"expectedStability,omitempty"`
  351. // IndoorLevel: The indoor level information for this beacon, if known.
  352. // As returned by the
  353. // Google Maps API.
  354. // Optional.
  355. IndoorLevel *IndoorLevel `json:"indoorLevel,omitempty"`
  356. // LatLng: The location of the beacon, expressed as a latitude and
  357. // longitude pair.
  358. // This location is given when the beacon is registered or updated. It
  359. // does
  360. // not necessarily indicate the actual current location of the
  361. // beacon.
  362. // Optional.
  363. LatLng *LatLng `json:"latLng,omitempty"`
  364. // PlaceId: The [Google Places API](/places/place-id) Place ID of the
  365. // place where
  366. // the beacon is deployed. This is given when the beacon is registered
  367. // or
  368. // updated, not automatically detected in any way.
  369. // Optional.
  370. PlaceId string `json:"placeId,omitempty"`
  371. // Properties: Properties of the beacon device, for example battery type
  372. // or firmware
  373. // version.
  374. // Optional.
  375. Properties map[string]string `json:"properties,omitempty"`
  376. // ProvisioningKey: Some beacons may require a user to provide an
  377. // authorization key before
  378. // changing any of its configuration (e.g. broadcast frames, transmit
  379. // power).
  380. // This field provides a place to store and control access to that
  381. // key.
  382. // This field is populated in responses to `GET
  383. // /v1beta1/beacons/3!beaconId`
  384. // from users with write access to the given beacon. That is to say: If
  385. // the
  386. // user is authorized to write the beacon's confidential data in the
  387. // service,
  388. // the service considers them authorized to configure the beacon.
  389. // Note
  390. // that this key grants nothing on the service, only on the beacon
  391. // itself.
  392. ProvisioningKey string `json:"provisioningKey,omitempty"`
  393. // Status: Current status of the beacon.
  394. // Required.
  395. //
  396. // Possible values:
  397. // "STATUS_UNSPECIFIED" - Do not use this value.
  398. // "ACTIVE" - The "normal" in-use state of a beacon.
  399. // "DECOMMISSIONED" - Beacon should no longer be used for any purpose.
  400. // This is irreversible.
  401. // "INACTIVE" - The beacon should not be visible to mobile devices.
  402. // This is reversible.
  403. Status string `json:"status,omitempty"`
  404. // ServerResponse contains the HTTP response code and headers from the
  405. // server.
  406. googleapi.ServerResponse `json:"-"`
  407. // ForceSendFields is a list of field names (e.g. "AdvertisedId") to
  408. // unconditionally include in API requests. By default, fields with
  409. // empty values are omitted from API requests. However, any non-pointer,
  410. // non-interface field appearing in ForceSendFields will be sent to the
  411. // server regardless of whether the field is empty or not. This may be
  412. // used to include empty fields in Patch requests.
  413. ForceSendFields []string `json:"-"`
  414. // NullFields is a list of field names (e.g. "AdvertisedId") to include
  415. // in API requests with the JSON null value. By default, fields with
  416. // empty values are omitted from API requests. However, any field with
  417. // an empty value appearing in NullFields will be sent to the server as
  418. // null. It is an error if a field in this list has a non-empty value.
  419. // This may be used to include null fields in Patch requests.
  420. NullFields []string `json:"-"`
  421. }
  422. func (s *Beacon) MarshalJSON() ([]byte, error) {
  423. type NoMethod Beacon
  424. raw := NoMethod(*s)
  425. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  426. }
  427. // BeaconAttachment: Project-specific data associated with a beacon.
  428. type BeaconAttachment struct {
  429. // AttachmentName: Resource name of this attachment. Attachment names
  430. // have the
  431. // format:
  432. // <code>beacons/<var>beacon_id</var>/attachments/<var>attachment
  433. // _id</var></code>.
  434. // Leave this empty on creation.
  435. AttachmentName string `json:"attachmentName,omitempty"`
  436. // CreationTimeMs: The UTC time when this attachment was created, in
  437. // milliseconds since the
  438. // UNIX epoch.
  439. CreationTimeMs string `json:"creationTimeMs,omitempty"`
  440. // Data: An opaque data container for client-provided data. Must
  441. // be
  442. // [base64](http://tools.ietf.org/html/rfc4648#section-4) encoded in
  443. // HTTP
  444. // requests, and will be so encoded (with padding) in
  445. // responses.
  446. // Required.
  447. Data string `json:"data,omitempty"`
  448. // MaxDistanceMeters: The distance away from the beacon at which this
  449. // attachment should be
  450. // delivered to a mobile app.
  451. //
  452. // Setting this to a value greater than zero indicates that the app
  453. // should
  454. // behave as if the beacon is "seen" when the mobile device is less than
  455. // this
  456. // distance away from the beacon.
  457. //
  458. // Different attachments on the same beacon can have different max
  459. // distances.
  460. //
  461. // Note that even though this value is expressed with fractional
  462. // meter
  463. // precision, real-world behavior is likley to be much less precise than
  464. // one
  465. // meter, due to the nature of current Bluetooth radio
  466. // technology.
  467. //
  468. // Optional. When not set or zero, the attachment should be delivered at
  469. // the
  470. // beacon's outer limit of detection.
  471. //
  472. // Negative values are invalid and return an error.
  473. MaxDistanceMeters float64 `json:"maxDistanceMeters,omitempty"`
  474. // NamespacedType: Specifies what kind of attachment this is. Tells a
  475. // client how to
  476. // interpret the `data` field. Format is <var>namespace/type</var>.
  477. // Namespace
  478. // provides type separation between clients. Type describes the type
  479. // of
  480. // `data`, for use by the client when parsing the `data`
  481. // field.
  482. // Required.
  483. NamespacedType string `json:"namespacedType,omitempty"`
  484. // ServerResponse contains the HTTP response code and headers from the
  485. // server.
  486. googleapi.ServerResponse `json:"-"`
  487. // ForceSendFields is a list of field names (e.g. "AttachmentName") to
  488. // unconditionally include in API requests. By default, fields with
  489. // empty values are omitted from API requests. However, any non-pointer,
  490. // non-interface field appearing in ForceSendFields will be sent to the
  491. // server regardless of whether the field is empty or not. This may be
  492. // used to include empty fields in Patch requests.
  493. ForceSendFields []string `json:"-"`
  494. // NullFields is a list of field names (e.g. "AttachmentName") to
  495. // include in API requests with the JSON null value. By default, fields
  496. // with empty values are omitted from API requests. However, any field
  497. // with an empty value appearing in NullFields will be sent to the
  498. // server as null. It is an error if a field in this list has a
  499. // non-empty value. This may be used to include null fields in Patch
  500. // requests.
  501. NullFields []string `json:"-"`
  502. }
  503. func (s *BeaconAttachment) MarshalJSON() ([]byte, error) {
  504. type NoMethod BeaconAttachment
  505. raw := NoMethod(*s)
  506. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  507. }
  508. func (s *BeaconAttachment) UnmarshalJSON(data []byte) error {
  509. type NoMethod BeaconAttachment
  510. var s1 struct {
  511. MaxDistanceMeters gensupport.JSONFloat64 `json:"maxDistanceMeters"`
  512. *NoMethod
  513. }
  514. s1.NoMethod = (*NoMethod)(s)
  515. if err := json.Unmarshal(data, &s1); err != nil {
  516. return err
  517. }
  518. s.MaxDistanceMeters = float64(s1.MaxDistanceMeters)
  519. return nil
  520. }
  521. // BeaconInfo: A subset of beacon information served via the
  522. // `beaconinfo.getforobserved`
  523. // method, which you call when users of your app encounter your beacons.
  524. type BeaconInfo struct {
  525. // AdvertisedId: The ID advertised by the beacon.
  526. AdvertisedId *AdvertisedId `json:"advertisedId,omitempty"`
  527. // Attachments: Attachments matching the type(s) requested.
  528. // May be empty if no attachment types were requested.
  529. Attachments []*AttachmentInfo `json:"attachments,omitempty"`
  530. // BeaconName: The name under which the beacon is registered.
  531. BeaconName string `json:"beaconName,omitempty"`
  532. // ForceSendFields is a list of field names (e.g. "AdvertisedId") to
  533. // unconditionally include in API requests. By default, fields with
  534. // empty values are omitted from API requests. However, any non-pointer,
  535. // non-interface field appearing in ForceSendFields will be sent to the
  536. // server regardless of whether the field is empty or not. This may be
  537. // used to include empty fields in Patch requests.
  538. ForceSendFields []string `json:"-"`
  539. // NullFields is a list of field names (e.g. "AdvertisedId") to include
  540. // in API requests with the JSON null value. By default, fields with
  541. // empty values are omitted from API requests. However, any field with
  542. // an empty value appearing in NullFields will be sent to the server as
  543. // null. It is an error if a field in this list has a non-empty value.
  544. // This may be used to include null fields in Patch requests.
  545. NullFields []string `json:"-"`
  546. }
  547. func (s *BeaconInfo) MarshalJSON() ([]byte, error) {
  548. type NoMethod BeaconInfo
  549. raw := NoMethod(*s)
  550. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  551. }
  552. // Date: Represents a whole or partial calendar date, e.g. a birthday.
  553. // The time of day
  554. // and time zone are either specified elsewhere or are not significant.
  555. // The date
  556. // is relative to the Proleptic Gregorian Calendar. This can
  557. // represent:
  558. //
  559. // * A full date, with non-zero year, month and day values
  560. // * A month and day value, with a zero year, e.g. an anniversary
  561. // * A year on its own, with zero month and day values
  562. // * A year and month value, with a zero day, e.g. a credit card
  563. // expiration date
  564. //
  565. // Related types are google.type.TimeOfDay and
  566. // `google.protobuf.Timestamp`.
  567. type Date struct {
  568. // Day: Day of month. Must be from 1 to 31 and valid for the year and
  569. // month, or 0
  570. // if specifying a year by itself or a year and month where the day is
  571. // not
  572. // significant.
  573. Day int64 `json:"day,omitempty"`
  574. // Month: Month of year. Must be from 1 to 12, or 0 if specifying a year
  575. // without a
  576. // month and day.
  577. Month int64 `json:"month,omitempty"`
  578. // Year: Year of date. Must be from 1 to 9999, or 0 if specifying a date
  579. // without
  580. // a year.
  581. Year int64 `json:"year,omitempty"`
  582. // ForceSendFields is a list of field names (e.g. "Day") to
  583. // unconditionally include in API requests. By default, fields with
  584. // empty values are omitted from API requests. However, any non-pointer,
  585. // non-interface field appearing in ForceSendFields will be sent to the
  586. // server regardless of whether the field is empty or not. This may be
  587. // used to include empty fields in Patch requests.
  588. ForceSendFields []string `json:"-"`
  589. // NullFields is a list of field names (e.g. "Day") to include in API
  590. // requests with the JSON null value. By default, fields with empty
  591. // values are omitted from API requests. However, any field with an
  592. // empty value appearing in NullFields will be sent to the server as
  593. // null. It is an error if a field in this list has a non-empty value.
  594. // This may be used to include null fields in Patch requests.
  595. NullFields []string `json:"-"`
  596. }
  597. func (s *Date) MarshalJSON() ([]byte, error) {
  598. type NoMethod Date
  599. raw := NoMethod(*s)
  600. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  601. }
  602. // DeleteAttachmentsResponse: Response for a request to delete
  603. // attachments.
  604. type DeleteAttachmentsResponse struct {
  605. // NumDeleted: The number of attachments that were deleted.
  606. NumDeleted int64 `json:"numDeleted,omitempty"`
  607. // ServerResponse contains the HTTP response code and headers from the
  608. // server.
  609. googleapi.ServerResponse `json:"-"`
  610. // ForceSendFields is a list of field names (e.g. "NumDeleted") to
  611. // unconditionally include in API requests. By default, fields with
  612. // empty values are omitted from API requests. However, any non-pointer,
  613. // non-interface field appearing in ForceSendFields will be sent to the
  614. // server regardless of whether the field is empty or not. This may be
  615. // used to include empty fields in Patch requests.
  616. ForceSendFields []string `json:"-"`
  617. // NullFields is a list of field names (e.g. "NumDeleted") to include in
  618. // API requests with the JSON null value. By default, fields with empty
  619. // values are omitted from API requests. However, any field with an
  620. // empty value appearing in NullFields will be sent to the server as
  621. // null. It is an error if a field in this list has a non-empty value.
  622. // This may be used to include null fields in Patch requests.
  623. NullFields []string `json:"-"`
  624. }
  625. func (s *DeleteAttachmentsResponse) MarshalJSON() ([]byte, error) {
  626. type NoMethod DeleteAttachmentsResponse
  627. raw := NoMethod(*s)
  628. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  629. }
  630. // Diagnostics: Diagnostics for a single beacon.
  631. type Diagnostics struct {
  632. // Alerts: An unordered list of Alerts that the beacon has.
  633. //
  634. // Possible values:
  635. // "ALERT_UNSPECIFIED" - Invalid value. Should never appear.
  636. // "WRONG_LOCATION" - The beacon has been reported far from its
  637. // expected location (the beacon's
  638. // lat_lng field if populated, otherwise, if the beacon's place_id field
  639. // is
  640. // present, the center of that place). This may indicate that the beacon
  641. // has
  642. // been moved. This signal is not 100% accurate, but indicates that
  643. // further
  644. // investigation is worthwhile.
  645. // "LOW_BATTERY" - The battery level for the beacon is low enough
  646. // that, given the beacon's
  647. // current use, its battery will run out with in the next 60 days.
  648. // This
  649. // indicates that the battery should be replaced soon.
  650. // "LOW_ACTIVITY" - The beacon has been reported at a very low rate or
  651. // not at all. This may
  652. // indicate that the beacon is broken or just that no one has gone near
  653. // the
  654. // beacon in recent days. If this status appears unexpectedly, the
  655. // beacon
  656. // owner should investigate further.
  657. Alerts []string `json:"alerts,omitempty"`
  658. // BeaconName: Resource name of the beacon. For Eddystone-EID beacons,
  659. // this may
  660. // be the beacon's current EID, or the beacon's "stable" Eddystone-UID.
  661. BeaconName string `json:"beaconName,omitempty"`
  662. // EstimatedLowBatteryDate: The date when the battery is expected to be
  663. // low. If the value is missing
  664. // then there is no estimate for when the battery will be low.
  665. // This value is only an estimate, not an exact date.
  666. EstimatedLowBatteryDate *Date `json:"estimatedLowBatteryDate,omitempty"`
  667. // ForceSendFields is a list of field names (e.g. "Alerts") to
  668. // unconditionally include in API requests. By default, fields with
  669. // empty values are omitted from API requests. However, any non-pointer,
  670. // non-interface field appearing in ForceSendFields will be sent to the
  671. // server regardless of whether the field is empty or not. This may be
  672. // used to include empty fields in Patch requests.
  673. ForceSendFields []string `json:"-"`
  674. // NullFields is a list of field names (e.g. "Alerts") to include in API
  675. // requests with the JSON null value. By default, fields with empty
  676. // values are omitted from API requests. However, any field with an
  677. // empty value appearing in NullFields will be sent to the server as
  678. // null. It is an error if a field in this list has a non-empty value.
  679. // This may be used to include null fields in Patch requests.
  680. NullFields []string `json:"-"`
  681. }
  682. func (s *Diagnostics) MarshalJSON() ([]byte, error) {
  683. type NoMethod Diagnostics
  684. raw := NoMethod(*s)
  685. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  686. }
  687. // Empty: A generic empty message that you can re-use to avoid defining
  688. // duplicated
  689. // empty messages in your APIs. A typical example is to use it as the
  690. // request
  691. // or the response type of an API method. For instance:
  692. //
  693. // service Foo {
  694. // rpc Bar(google.protobuf.Empty) returns
  695. // (google.protobuf.Empty);
  696. // }
  697. //
  698. // The JSON representation for `Empty` is empty JSON object `{}`.
  699. type Empty struct {
  700. // ServerResponse contains the HTTP response code and headers from the
  701. // server.
  702. googleapi.ServerResponse `json:"-"`
  703. }
  704. // EphemeralIdRegistration: Write-only registration parameters for
  705. // beacons using Eddystone-EID format.
  706. // Two ways of securely registering an Eddystone-EID beacon with the
  707. // service
  708. // are supported:
  709. //
  710. // 1. Perform an ECDH key exchange via this API, including a previous
  711. // call
  712. // to `GET /v1beta1/eidparams`. In this case the fields
  713. // `beacon_ecdh_public_key` and `service_ecdh_public_key` should be
  714. // populated and `beacon_identity_key` should not be populated. This
  715. // method ensures that only the two parties in the ECDH key exchange
  716. // can
  717. // compute the identity key, which becomes a secret between them.
  718. // 2. Derive or obtain the beacon's identity key via other secure means
  719. // (perhaps an ECDH key exchange between the beacon and a mobile
  720. // device
  721. // or any other secure method), and then submit the resulting
  722. // identity key
  723. // to the service. In this case `beacon_identity_key` field should
  724. // be
  725. // populated, and neither of `beacon_ecdh_public_key` nor
  726. // `service_ecdh_public_key` fields should be. The security of this
  727. // method
  728. // depends on how securely the parties involved (in particular the
  729. // bluetooth client) handle the identity key, and obviously on how
  730. // securely the identity key was generated.
  731. //
  732. // See [the
  733. // Eddystone
  734. // specification](https://github.com/google/eddystone/tree/mast
  735. // er/eddystone-eid)
  736. // at GitHub.
  737. type EphemeralIdRegistration struct {
  738. // BeaconEcdhPublicKey: The beacon's public key used for the Elliptic
  739. // curve Diffie-Hellman
  740. // key exchange. When this field is populated,
  741. // `service_ecdh_public_key`
  742. // must also be populated, and `beacon_identity_key` must not be.
  743. BeaconEcdhPublicKey string `json:"beaconEcdhPublicKey,omitempty"`
  744. // BeaconIdentityKey: The private key of the beacon. If this field is
  745. // populated,
  746. // `beacon_ecdh_public_key` and `service_ecdh_public_key` must not
  747. // be
  748. // populated.
  749. BeaconIdentityKey string `json:"beaconIdentityKey,omitempty"`
  750. // InitialClockValue: The initial clock value of the beacon. The
  751. // beacon's clock must have
  752. // begun counting at this value immediately prior to transmitting
  753. // this
  754. // value to the resolving service. Significant delay in transmitting
  755. // this
  756. // value to the service risks registration or resolution failures. If
  757. // a
  758. // value is not provided, the default is zero.
  759. InitialClockValue uint64 `json:"initialClockValue,omitempty,string"`
  760. // InitialEid: An initial ephemeral ID calculated using the clock value
  761. // submitted as
  762. // `initial_clock_value`, and the secret key generated by
  763. // the
  764. // Diffie-Hellman key exchange using `service_ecdh_public_key`
  765. // and
  766. // `service_ecdh_public_key`. This initial EID value will be used by
  767. // the
  768. // service to confirm that the key exchange process was successful.
  769. InitialEid string `json:"initialEid,omitempty"`
  770. // RotationPeriodExponent: Indicates the nominal period between each
  771. // rotation of the beacon's
  772. // ephemeral ID. "Nominal" because the beacon should randomize
  773. // the
  774. // actual interval. See [the spec
  775. // at
  776. // github](https://github.com/google/eddystone/tree/master/eddystone-e
  777. // id)
  778. // for details. This value corresponds to a power-of-two scaler on
  779. // the
  780. // beacon's clock: when the scaler value is K, the beacon will
  781. // begin
  782. // broadcasting a new ephemeral ID on average every 2^K seconds.
  783. RotationPeriodExponent int64 `json:"rotationPeriodExponent,omitempty"`
  784. // ServiceEcdhPublicKey: The service's public key used for the Elliptic
  785. // curve Diffie-Hellman
  786. // key exchange. When this field is populated,
  787. // `beacon_ecdh_public_key`
  788. // must also be populated, and `beacon_identity_key` must not be.
  789. ServiceEcdhPublicKey string `json:"serviceEcdhPublicKey,omitempty"`
  790. // ForceSendFields is a list of field names (e.g. "BeaconEcdhPublicKey")
  791. // to unconditionally include in API requests. By default, fields with
  792. // empty values are omitted from API requests. However, any non-pointer,
  793. // non-interface field appearing in ForceSendFields will be sent to the
  794. // server regardless of whether the field is empty or not. This may be
  795. // used to include empty fields in Patch requests.
  796. ForceSendFields []string `json:"-"`
  797. // NullFields is a list of field names (e.g. "BeaconEcdhPublicKey") to
  798. // include in API requests with the JSON null value. By default, fields
  799. // with empty values are omitted from API requests. However, any field
  800. // with an empty value appearing in NullFields will be sent to the
  801. // server as null. It is an error if a field in this list has a
  802. // non-empty value. This may be used to include null fields in Patch
  803. // requests.
  804. NullFields []string `json:"-"`
  805. }
  806. func (s *EphemeralIdRegistration) MarshalJSON() ([]byte, error) {
  807. type NoMethod EphemeralIdRegistration
  808. raw := NoMethod(*s)
  809. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  810. }
  811. // EphemeralIdRegistrationParams: Information a client needs to
  812. // provision and register beacons that
  813. // broadcast Eddystone-EID format beacon IDs, using Elliptic
  814. // curve
  815. // Diffie-Hellman key exchange. See
  816. // [the Eddystone
  817. // specification](https://github.com/google/eddystone/tree/master/eddysto
  818. // ne-eid) at GitHub.
  819. type EphemeralIdRegistrationParams struct {
  820. // MaxRotationPeriodExponent: Indicates the maximum rotation period
  821. // supported by the service.
  822. // See EddystoneEidRegistration.rotation_period_exponent
  823. MaxRotationPeriodExponent int64 `json:"maxRotationPeriodExponent,omitempty"`
  824. // MinRotationPeriodExponent: Indicates the minimum rotation period
  825. // supported by the service.
  826. // See EddystoneEidRegistration.rotation_period_exponent
  827. MinRotationPeriodExponent int64 `json:"minRotationPeriodExponent,omitempty"`
  828. // ServiceEcdhPublicKey: The beacon service's public key for use by a
  829. // beacon to derive its
  830. // Identity Key using Elliptic Curve Diffie-Hellman key exchange.
  831. ServiceEcdhPublicKey string `json:"serviceEcdhPublicKey,omitempty"`
  832. // ServerResponse contains the HTTP response code and headers from the
  833. // server.
  834. googleapi.ServerResponse `json:"-"`
  835. // ForceSendFields is a list of field names (e.g.
  836. // "MaxRotationPeriodExponent") to unconditionally include in API
  837. // requests. By default, fields with empty values are omitted from API
  838. // requests. However, any non-pointer, non-interface field appearing in
  839. // ForceSendFields will be sent to the server regardless of whether the
  840. // field is empty or not. This may be used to include empty fields in
  841. // Patch requests.
  842. ForceSendFields []string `json:"-"`
  843. // NullFields is a list of field names (e.g.
  844. // "MaxRotationPeriodExponent") to include in API requests with the JSON
  845. // null value. By default, fields with empty values are omitted from API
  846. // requests. However, any field with an empty value appearing in
  847. // NullFields will be sent to the server as null. It is an error if a
  848. // field in this list has a non-empty value. This may be used to include
  849. // null fields in Patch requests.
  850. NullFields []string `json:"-"`
  851. }
  852. func (s *EphemeralIdRegistrationParams) MarshalJSON() ([]byte, error) {
  853. type NoMethod EphemeralIdRegistrationParams
  854. raw := NoMethod(*s)
  855. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  856. }
  857. // GetInfoForObservedBeaconsRequest: Request for beacon and attachment
  858. // information about beacons that
  859. // a mobile client has encountered "in the wild".
  860. type GetInfoForObservedBeaconsRequest struct {
  861. // NamespacedTypes: Specifies what kind of attachments to include in the
  862. // response.
  863. // When given, the response will include only attachments of the given
  864. // types.
  865. // When empty, no attachments will be returned. Must be in the
  866. // format
  867. // <var>namespace/type</var>. Accepts `*` to specify all types in
  868. // all namespaces owned by the client.
  869. // Optional.
  870. NamespacedTypes []string `json:"namespacedTypes,omitempty"`
  871. // Observations: The beacons that the client has encountered.
  872. // At least one must be given.
  873. Observations []*Observation `json:"observations,omitempty"`
  874. // ForceSendFields is a list of field names (e.g. "NamespacedTypes") to
  875. // unconditionally include in API requests. By default, fields with
  876. // empty values are omitted from API requests. However, any non-pointer,
  877. // non-interface field appearing in ForceSendFields will be sent to the
  878. // server regardless of whether the field is empty or not. This may be
  879. // used to include empty fields in Patch requests.
  880. ForceSendFields []string `json:"-"`
  881. // NullFields is a list of field names (e.g. "NamespacedTypes") to
  882. // include in API requests with the JSON null value. By default, fields
  883. // with empty values are omitted from API requests. However, any field
  884. // with an empty value appearing in NullFields will be sent to the
  885. // server as null. It is an error if a field in this list has a
  886. // non-empty value. This may be used to include null fields in Patch
  887. // requests.
  888. NullFields []string `json:"-"`
  889. }
  890. func (s *GetInfoForObservedBeaconsRequest) MarshalJSON() ([]byte, error) {
  891. type NoMethod GetInfoForObservedBeaconsRequest
  892. raw := NoMethod(*s)
  893. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  894. }
  895. // GetInfoForObservedBeaconsResponse: Information about the requested
  896. // beacons, optionally including attachment
  897. // data.
  898. type GetInfoForObservedBeaconsResponse struct {
  899. // Beacons: Public information about beacons.
  900. // May be empty if the request matched no beacons.
  901. Beacons []*BeaconInfo `json:"beacons,omitempty"`
  902. // ServerResponse contains the HTTP response code and headers from the
  903. // server.
  904. googleapi.ServerResponse `json:"-"`
  905. // ForceSendFields is a list of field names (e.g. "Beacons") to
  906. // unconditionally include in API requests. By default, fields with
  907. // empty values are omitted from API requests. However, any non-pointer,
  908. // non-interface field appearing in ForceSendFields will be sent to the
  909. // server regardless of whether the field is empty or not. This may be
  910. // used to include empty fields in Patch requests.
  911. ForceSendFields []string `json:"-"`
  912. // NullFields is a list of field names (e.g. "Beacons") to include in
  913. // API requests with the JSON null value. By default, fields with empty
  914. // values are omitted from API requests. However, any field with an
  915. // empty value appearing in NullFields will be sent to the server as
  916. // null. It is an error if a field in this list has a non-empty value.
  917. // This may be used to include null fields in Patch requests.
  918. NullFields []string `json:"-"`
  919. }
  920. func (s *GetInfoForObservedBeaconsResponse) MarshalJSON() ([]byte, error) {
  921. type NoMethod GetInfoForObservedBeaconsResponse
  922. raw := NoMethod(*s)
  923. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  924. }
  925. // IndoorLevel: Indoor level, a human-readable string as returned by
  926. // Google Maps APIs,
  927. // useful to indicate which floor of a building a beacon is located on.
  928. type IndoorLevel struct {
  929. // Name: The name of this level.
  930. Name string `json:"name,omitempty"`
  931. // ForceSendFields is a list of field names (e.g. "Name") to
  932. // unconditionally include in API requests. By default, fields with
  933. // empty values are omitted from API requests. However, any non-pointer,
  934. // non-interface field appearing in ForceSendFields will be sent to the
  935. // server regardless of whether the field is empty or not. This may be
  936. // used to include empty fields in Patch requests.
  937. ForceSendFields []string `json:"-"`
  938. // NullFields is a list of field names (e.g. "Name") to include in API
  939. // requests with the JSON null value. By default, fields with empty
  940. // values are omitted from API requests. However, any field with an
  941. // empty value appearing in NullFields will be sent to the server as
  942. // null. It is an error if a field in this list has a non-empty value.
  943. // This may be used to include null fields in Patch requests.
  944. NullFields []string `json:"-"`
  945. }
  946. func (s *IndoorLevel) MarshalJSON() ([]byte, error) {
  947. type NoMethod IndoorLevel
  948. raw := NoMethod(*s)
  949. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  950. }
  951. // LatLng: An object representing a latitude/longitude pair. This is
  952. // expressed as a pair
  953. // of doubles representing degrees latitude and degrees longitude.
  954. // Unless
  955. // specified otherwise, this must conform to the
  956. // <a
  957. // href="http://www.unoosa.org/pdf/icg/2012/template/WGS_84.pdf">WGS84
  958. // st
  959. // andard</a>. Values must be within normalized ranges.
  960. type LatLng struct {
  961. // Latitude: The latitude in degrees. It must be in the range [-90.0,
  962. // +90.0].
  963. Latitude float64 `json:"latitude,omitempty"`
  964. // Longitude: The longitude in degrees. It must be in the range [-180.0,
  965. // +180.0].
  966. Longitude float64 `json:"longitude,omitempty"`
  967. // ForceSendFields is a list of field names (e.g. "Latitude") to
  968. // unconditionally include in API requests. By default, fields with
  969. // empty values are omitted from API requests. However, any non-pointer,
  970. // non-interface field appearing in ForceSendFields will be sent to the
  971. // server regardless of whether the field is empty or not. This may be
  972. // used to include empty fields in Patch requests.
  973. ForceSendFields []string `json:"-"`
  974. // NullFields is a list of field names (e.g. "Latitude") to include in
  975. // API requests with the JSON null value. By default, fields with empty
  976. // values are omitted from API requests. However, any field with an
  977. // empty value appearing in NullFields will be sent to the server as
  978. // null. It is an error if a field in this list has a non-empty value.
  979. // This may be used to include null fields in Patch requests.
  980. NullFields []string `json:"-"`
  981. }
  982. func (s *LatLng) MarshalJSON() ([]byte, error) {
  983. type NoMethod LatLng
  984. raw := NoMethod(*s)
  985. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  986. }
  987. func (s *LatLng) UnmarshalJSON(data []byte) error {
  988. type NoMethod LatLng
  989. var s1 struct {
  990. Latitude gensupport.JSONFloat64 `json:"latitude"`
  991. Longitude gensupport.JSONFloat64 `json:"longitude"`
  992. *NoMethod
  993. }
  994. s1.NoMethod = (*NoMethod)(s)
  995. if err := json.Unmarshal(data, &s1); err != nil {
  996. return err
  997. }
  998. s.Latitude = float64(s1.Latitude)
  999. s.Longitude = float64(s1.Longitude)
  1000. return nil
  1001. }
  1002. // ListBeaconAttachmentsResponse: Response to `ListBeaconAttachments`
  1003. // that contains the requested attachments.
  1004. type ListBeaconAttachmentsResponse struct {
  1005. // Attachments: The attachments that corresponded to the request params.
  1006. Attachments []*BeaconAttachment `json:"attachments,omitempty"`
  1007. // ServerResponse contains the HTTP response code and headers from the
  1008. // server.
  1009. googleapi.ServerResponse `json:"-"`
  1010. // ForceSendFields is a list of field names (e.g. "Attachments") to
  1011. // unconditionally include in API requests. By default, fields with
  1012. // empty values are omitted from API requests. However, any non-pointer,
  1013. // non-interface field appearing in ForceSendFields will be sent to the
  1014. // server regardless of whether the field is empty or not. This may be
  1015. // used to include empty fields in Patch requests.
  1016. ForceSendFields []string `json:"-"`
  1017. // NullFields is a list of field names (e.g. "Attachments") to include
  1018. // in API requests with the JSON null value. By default, fields with
  1019. // empty values are omitted from API requests. However, any field with
  1020. // an empty value appearing in NullFields will be sent to the server as
  1021. // null. It is an error if a field in this list has a non-empty value.
  1022. // This may be used to include null fields in Patch requests.
  1023. NullFields []string `json:"-"`
  1024. }
  1025. func (s *ListBeaconAttachmentsResponse) MarshalJSON() ([]byte, error) {
  1026. type NoMethod ListBeaconAttachmentsResponse
  1027. raw := NoMethod(*s)
  1028. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1029. }
  1030. // ListBeaconsResponse: Response that contains list beacon results and
  1031. // pagination help.
  1032. type ListBeaconsResponse struct {
  1033. // Beacons: The beacons that matched the search criteria.
  1034. Beacons []*Beacon `json:"beacons,omitempty"`
  1035. // NextPageToken: An opaque pagination token that the client may provide
  1036. // in their next
  1037. // request to retrieve the next page of results.
  1038. NextPageToken string `json:"nextPageToken,omitempty"`
  1039. // TotalCount: Estimate of the total number of beacons matched by the
  1040. // query. Higher
  1041. // values may be less accurate.
  1042. TotalCount int64 `json:"totalCount,omitempty,string"`
  1043. // ServerResponse contains the HTTP response code and headers from the
  1044. // server.
  1045. googleapi.ServerResponse `json:"-"`
  1046. // ForceSendFields is a list of field names (e.g. "Beacons") to
  1047. // unconditionally include in API requests. By default, fields with
  1048. // empty values are omitted from API requests. However, any non-pointer,
  1049. // non-interface field appearing in ForceSendFields will be sent to the
  1050. // server regardless of whether the field is empty or not. This may be
  1051. // used to include empty fields in Patch requests.
  1052. ForceSendFields []string `json:"-"`
  1053. // NullFields is a list of field names (e.g. "Beacons") to include in
  1054. // API requests with the JSON null value. By default, fields with empty
  1055. // values are omitted from API requests. However, any field with an
  1056. // empty value appearing in NullFields will be sent to the server as
  1057. // null. It is an error if a field in this list has a non-empty value.
  1058. // This may be used to include null fields in Patch requests.
  1059. NullFields []string `json:"-"`
  1060. }
  1061. func (s *ListBeaconsResponse) MarshalJSON() ([]byte, error) {
  1062. type NoMethod ListBeaconsResponse
  1063. raw := NoMethod(*s)
  1064. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1065. }
  1066. // ListDiagnosticsResponse: Response that contains the requested
  1067. // diagnostics.
  1068. type ListDiagnosticsResponse struct {
  1069. // Diagnostics: The diagnostics matching the given request.
  1070. Diagnostics []*Diagnostics `json:"diagnostics,omitempty"`
  1071. // NextPageToken: Token that can be used for pagination. Returned only
  1072. // if the
  1073. // request matches more beacons than can be returned in this response.
  1074. NextPageToken string `json:"nextPageToken,omitempty"`
  1075. // ServerResponse contains the HTTP response code and headers from the
  1076. // server.
  1077. googleapi.ServerResponse `json:"-"`
  1078. // ForceSendFields is a list of field names (e.g. "Diagnostics") to
  1079. // unconditionally include in API requests. By default, fields with
  1080. // empty values are omitted from API requests. However, any non-pointer,
  1081. // non-interface field appearing in ForceSendFields will be sent to the
  1082. // server regardless of whether the field is empty or not. This may be
  1083. // used to include empty fields in Patch requests.
  1084. ForceSendFields []string `json:"-"`
  1085. // NullFields is a list of field names (e.g. "Diagnostics") to include
  1086. // in API requests with the JSON null value. By default, fields with
  1087. // empty values are omitted from API requests. However, any field with
  1088. // an empty value appearing in NullFields will be sent to the server as
  1089. // null. It is an error if a field in this list has a non-empty value.
  1090. // This may be used to include null fields in Patch requests.
  1091. NullFields []string `json:"-"`
  1092. }
  1093. func (s *ListDiagnosticsResponse) MarshalJSON() ([]byte, error) {
  1094. type NoMethod ListDiagnosticsResponse
  1095. raw := NoMethod(*s)
  1096. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1097. }
  1098. // ListNamespacesResponse: Response to ListNamespacesRequest that
  1099. // contains all the project's namespaces.
  1100. type ListNamespacesResponse struct {
  1101. // Namespaces: The attachments that corresponded to the request params.
  1102. Namespaces []*Namespace `json:"namespaces,omitempty"`
  1103. // ServerResponse contains the HTTP response code and headers from the
  1104. // server.
  1105. googleapi.ServerResponse `json:"-"`
  1106. // ForceSendFields is a list of field names (e.g. "Namespaces") to
  1107. // unconditionally include in API requests. By default, fields with
  1108. // empty values are omitted from API requests. However, any non-pointer,
  1109. // non-interface field appearing in ForceSendFields will be sent to the
  1110. // server regardless of whether the field is empty or not. This may be
  1111. // used to include empty fields in Patch requests.
  1112. ForceSendFields []string `json:"-"`
  1113. // NullFields is a list of field names (e.g. "Namespaces") to include in
  1114. // API requests with the JSON null value. By default, fields with empty
  1115. // values are omitted from API requests. However, any field with an
  1116. // empty value appearing in NullFields will be sent to the server as
  1117. // null. It is an error if a field in this list has a non-empty value.
  1118. // This may be used to include null fields in Patch requests.
  1119. NullFields []string `json:"-"`
  1120. }
  1121. func (s *ListNamespacesResponse) MarshalJSON() ([]byte, error) {
  1122. type NoMethod ListNamespacesResponse
  1123. raw := NoMethod(*s)
  1124. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1125. }
  1126. // Namespace: An attachment namespace defines read and write access for
  1127. // all the attachments
  1128. // created under it. Each namespace is globally unique, and owned by
  1129. // one
  1130. // project which is the only project that can create attachments under
  1131. // it.
  1132. type Namespace struct {
  1133. // NamespaceName: Resource name of this namespace. Namespaces names have
  1134. // the format:
  1135. // <code>namespaces/<var>namespace</var></code>.
  1136. NamespaceName string `json:"namespaceName,omitempty"`
  1137. // ServingVisibility: Specifies what clients may receive attachments
  1138. // under this namespace
  1139. // via `beaconinfo.getforobserved`.
  1140. //
  1141. // Possible values:
  1142. // "VISIBILITY_UNSPECIFIED" - Do not use this value.
  1143. // "UNLISTED" - Served only to the project that owns the namespace.
  1144. // "PUBLIC" - Any project can subscribe to attachments under the
  1145. // namespace.
  1146. ServingVisibility string `json:"servingVisibility,omitempty"`
  1147. // ServerResponse contains the HTTP response code and headers from the
  1148. // server.
  1149. googleapi.ServerResponse `json:"-"`
  1150. // ForceSendFields is a list of field names (e.g. "NamespaceName") to
  1151. // unconditionally include in API requests. By default, fields with
  1152. // empty values are omitted from API requests. However, any non-pointer,
  1153. // non-interface field appearing in ForceSendFields will be sent to the
  1154. // server regardless of whether the field is empty or not. This may be
  1155. // used to include empty fields in Patch requests.
  1156. ForceSendFields []string `json:"-"`
  1157. // NullFields is a list of field names (e.g. "NamespaceName") to include
  1158. // in API requests with the JSON null value. By default, fields with
  1159. // empty values are omitted from API requests. However, any field with
  1160. // an empty value appearing in NullFields will be sent to the server as
  1161. // null. It is an error if a field in this list has a non-empty value.
  1162. // This may be used to include null fields in Patch requests.
  1163. NullFields []string `json:"-"`
  1164. }
  1165. func (s *Namespace) MarshalJSON() ([]byte, error) {
  1166. type NoMethod Namespace
  1167. raw := NoMethod(*s)
  1168. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1169. }
  1170. // Observation: Represents one beacon observed once.
  1171. type Observation struct {
  1172. // AdvertisedId: The ID advertised by the beacon the client has
  1173. // encountered.
  1174. //
  1175. // If the submitted `advertised_id` type is Eddystone-EID, then the
  1176. // client
  1177. // must be authorized to resolve the given beacon. Otherwise no data
  1178. // will be
  1179. // returned for that beacon.
  1180. // Required.
  1181. AdvertisedId *AdvertisedId `json:"advertisedId,omitempty"`
  1182. // Telemetry: The array of telemetry bytes received from the beacon. The
  1183. // server is
  1184. // responsible for parsing it. This field may frequently be empty,
  1185. // as
  1186. // with a beacon that transmits telemetry only occasionally.
  1187. Telemetry string `json:"telemetry,omitempty"`
  1188. // TimestampMs: Time when the beacon was observed.
  1189. TimestampMs string `json:"timestampMs,omitempty"`
  1190. // ForceSendFields is a list of field names (e.g. "AdvertisedId") to
  1191. // unconditionally include in API requests. By default, fields with
  1192. // empty values are omitted from API requests. However, any non-pointer,
  1193. // non-interface field appearing in ForceSendFields will be sent to the
  1194. // server regardless of whether the field is empty or not. This may be
  1195. // used to include empty fields in Patch requests.
  1196. ForceSendFields []string `json:"-"`
  1197. // NullFields is a list of field names (e.g. "AdvertisedId") to include
  1198. // in API requests with the JSON null value. By default, fields with
  1199. // empty values are omitted from API requests. However, any field with
  1200. // an empty value appearing in NullFields will be sent to the server as
  1201. // null. It is an error if a field in this list has a non-empty value.
  1202. // This may be used to include null fields in Patch requests.
  1203. NullFields []string `json:"-"`
  1204. }
  1205. func (s *Observation) MarshalJSON() ([]byte, error) {
  1206. type NoMethod Observation
  1207. raw := NoMethod(*s)
  1208. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1209. }
  1210. // method id "proximitybeacon.beaconinfo.getforobserved":
  1211. type BeaconinfoGetforobservedCall struct {
  1212. s *Service
  1213. getinfoforobservedbeaconsrequest *GetInfoForObservedBeaconsRequest
  1214. urlParams_ gensupport.URLParams
  1215. ctx_ context.Context
  1216. header_ http.Header
  1217. }
  1218. // Getforobserved: Given one or more beacon observations, returns any
  1219. // beacon information
  1220. // and attachments accessible to your application. Authorize by using
  1221. // the
  1222. // [API
  1223. // key](https://developers.google.com/beacons/proximity/get-started#reque
  1224. // st_a_browser_api_key)
  1225. // for the application.
  1226. func (r *BeaconinfoService) Getforobserved(getinfoforobservedbeaconsrequest *GetInfoForObservedBeaconsRequest) *BeaconinfoGetforobservedCall {
  1227. c := &BeaconinfoGetforobservedCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1228. c.getinfoforobservedbeaconsrequest = getinfoforobservedbeaconsrequest
  1229. return c
  1230. }
  1231. // Fields allows partial responses to be retrieved. See
  1232. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1233. // for more information.
  1234. func (c *BeaconinfoGetforobservedCall) Fields(s ...googleapi.Field) *BeaconinfoGetforobservedCall {
  1235. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1236. return c
  1237. }
  1238. // Context sets the context to be used in this call's Do method. Any
  1239. // pending HTTP request will be aborted if the provided context is
  1240. // canceled.
  1241. func (c *BeaconinfoGetforobservedCall) Context(ctx context.Context) *BeaconinfoGetforobservedCall {
  1242. c.ctx_ = ctx
  1243. return c
  1244. }
  1245. // Header returns an http.Header that can be modified by the caller to
  1246. // add HTTP headers to the request.
  1247. func (c *BeaconinfoGetforobservedCall) Header() http.Header {
  1248. if c.header_ == nil {
  1249. c.header_ = make(http.Header)
  1250. }
  1251. return c.header_
  1252. }
  1253. func (c *BeaconinfoGetforobservedCall) doRequest(alt string) (*http.Response, error) {
  1254. reqHeaders := make(http.Header)
  1255. for k, v := range c.header_ {
  1256. reqHeaders[k] = v
  1257. }
  1258. reqHeaders.Set("User-Agent", c.s.userAgent())
  1259. var body io.Reader = nil
  1260. body, err := googleapi.WithoutDataWrapper.JSONReader(c.getinfoforobservedbeaconsrequest)
  1261. if err != nil {
  1262. return nil, err
  1263. }
  1264. reqHeaders.Set("Content-Type", "application/json")
  1265. c.urlParams_.Set("alt", alt)
  1266. c.urlParams_.Set("prettyPrint", "false")
  1267. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/beaconinfo:getforobserved")
  1268. urls += "?" + c.urlParams_.Encode()
  1269. req, err := http.NewRequest("POST", urls, body)
  1270. if err != nil {
  1271. return nil, err
  1272. }
  1273. req.Header = reqHeaders
  1274. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1275. }
  1276. // Do executes the "proximitybeacon.beaconinfo.getforobserved" call.
  1277. // Exactly one of *GetInfoForObservedBeaconsResponse or error will be
  1278. // non-nil. Any non-2xx status code is an error. Response headers are in
  1279. // either *GetInfoForObservedBeaconsResponse.ServerResponse.Header or
  1280. // (if a response was returned at all) in
  1281. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  1282. // whether the returned error was because http.StatusNotModified was
  1283. // returned.
  1284. func (c *BeaconinfoGetforobservedCall) Do(opts ...googleapi.CallOption) (*GetInfoForObservedBeaconsResponse, error) {
  1285. gensupport.SetOptions(c.urlParams_, opts...)
  1286. res, err := c.doRequest("json")
  1287. if res != nil && res.StatusCode == http.StatusNotModified {
  1288. if res.Body != nil {
  1289. res.Body.Close()
  1290. }
  1291. return nil, &googleapi.Error{
  1292. Code: res.StatusCode,
  1293. Header: res.Header,
  1294. }
  1295. }
  1296. if err != nil {
  1297. return nil, err
  1298. }
  1299. defer googleapi.CloseBody(res)
  1300. if err := googleapi.CheckResponse(res); err != nil {
  1301. return nil, err
  1302. }
  1303. ret := &GetInfoForObservedBeaconsResponse{
  1304. ServerResponse: googleapi.ServerResponse{
  1305. Header: res.Header,
  1306. HTTPStatusCode: res.StatusCode,
  1307. },
  1308. }
  1309. target := &ret
  1310. if err := gensupport.DecodeResponse(target, res); err != nil {
  1311. return nil, err
  1312. }
  1313. return ret, nil
  1314. // {
  1315. // "description": "Given one or more beacon observations, returns any beacon information\nand attachments accessible to your application. Authorize by using the\n[API key](https://developers.google.com/beacons/proximity/get-started#request_a_browser_api_key)\nfor the application.",
  1316. // "flatPath": "v1beta1/beaconinfo:getforobserved",
  1317. // "httpMethod": "POST",
  1318. // "id": "proximitybeacon.beaconinfo.getforobserved",
  1319. // "parameterOrder": [],
  1320. // "parameters": {},
  1321. // "path": "v1beta1/beaconinfo:getforobserved",
  1322. // "request": {
  1323. // "$ref": "GetInfoForObservedBeaconsRequest"
  1324. // },
  1325. // "response": {
  1326. // "$ref": "GetInfoForObservedBeaconsResponse"
  1327. // }
  1328. // }
  1329. }
  1330. // method id "proximitybeacon.beacons.activate":
  1331. type BeaconsActivateCall struct {
  1332. s *Service
  1333. beaconName string
  1334. urlParams_ gensupport.URLParams
  1335. ctx_ context.Context
  1336. header_ http.Header
  1337. }
  1338. // Activate: Activates a beacon. A beacon that is active will return
  1339. // information
  1340. // and attachment data when queried via
  1341. // `beaconinfo.getforobserved`.
  1342. // Calling this method on an already active beacon will do nothing
  1343. // (but
  1344. // will return a successful response code).
  1345. //
  1346. // Authenticate using an [OAuth access
  1347. // token](https://developers.google.com/identity/protocols/OAuth2)
  1348. // from a signed-in user with **Is owner** or **Can edit** permissions
  1349. // in the
  1350. // Google Developers Console project.
  1351. func (r *BeaconsService) Activate(beaconName string) *BeaconsActivateCall {
  1352. c := &BeaconsActivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1353. c.beaconName = beaconName
  1354. return c
  1355. }
  1356. // ProjectId sets the optional parameter "projectId": The project id of
  1357. // the beacon to activate. If the project id is not
  1358. // specified then the project making the request is used. The project
  1359. // id
  1360. // must match the project that owns the beacon.
  1361. func (c *BeaconsActivateCall) ProjectId(projectId string) *BeaconsActivateCall {
  1362. c.urlParams_.Set("projectId", projectId)
  1363. return c
  1364. }
  1365. // Fields allows partial responses to be retrieved. See
  1366. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1367. // for more information.
  1368. func (c *BeaconsActivateCall) Fields(s ...googleapi.Field) *BeaconsActivateCall {
  1369. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1370. return c
  1371. }
  1372. // Context sets the context to be used in this call's Do method. Any
  1373. // pending HTTP request will be aborted if the provided context is
  1374. // canceled.
  1375. func (c *BeaconsActivateCall) Context(ctx context.Context) *BeaconsActivateCall {
  1376. c.ctx_ = ctx
  1377. return c
  1378. }
  1379. // Header returns an http.Header that can be modified by the caller to
  1380. // add HTTP headers to the request.
  1381. func (c *BeaconsActivateCall) Header() http.Header {
  1382. if c.header_ == nil {
  1383. c.header_ = make(http.Header)
  1384. }
  1385. return c.header_
  1386. }
  1387. func (c *BeaconsActivateCall) doRequest(alt string) (*http.Response, error) {
  1388. reqHeaders := make(http.Header)
  1389. for k, v := range c.header_ {
  1390. reqHeaders[k] = v
  1391. }
  1392. reqHeaders.Set("User-Agent", c.s.userAgent())
  1393. var body io.Reader = nil
  1394. c.urlParams_.Set("alt", alt)
  1395. c.urlParams_.Set("prettyPrint", "false")
  1396. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}:activate")
  1397. urls += "?" + c.urlParams_.Encode()
  1398. req, err := http.NewRequest("POST", urls, body)
  1399. if err != nil {
  1400. return nil, err
  1401. }
  1402. req.Header = reqHeaders
  1403. googleapi.Expand(req.URL, map[string]string{
  1404. "beaconName": c.beaconName,
  1405. })
  1406. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1407. }
  1408. // Do executes the "proximitybeacon.beacons.activate" call.
  1409. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1410. // code is an error. Response headers are in either
  1411. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1412. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1413. // check whether the returned error was because http.StatusNotModified
  1414. // was returned.
  1415. func (c *BeaconsActivateCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1416. gensupport.SetOptions(c.urlParams_, opts...)
  1417. res, err := c.doRequest("json")
  1418. if res != nil && res.StatusCode == http.StatusNotModified {
  1419. if res.Body != nil {
  1420. res.Body.Close()
  1421. }
  1422. return nil, &googleapi.Error{
  1423. Code: res.StatusCode,
  1424. Header: res.Header,
  1425. }
  1426. }
  1427. if err != nil {
  1428. return nil, err
  1429. }
  1430. defer googleapi.CloseBody(res)
  1431. if err := googleapi.CheckResponse(res); err != nil {
  1432. return nil, err
  1433. }
  1434. ret := &Empty{
  1435. ServerResponse: googleapi.ServerResponse{
  1436. Header: res.Header,
  1437. HTTPStatusCode: res.StatusCode,
  1438. },
  1439. }
  1440. target := &ret
  1441. if err := gensupport.DecodeResponse(target, res); err != nil {
  1442. return nil, err
  1443. }
  1444. return ret, nil
  1445. // {
  1446. // "description": "Activates a beacon. A beacon that is active will return information\nand attachment data when queried via `beaconinfo.getforobserved`.\nCalling this method on an already active beacon will do nothing (but\nwill return a successful response code).\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  1447. // "flatPath": "v1beta1/beacons/{beaconsId}:activate",
  1448. // "httpMethod": "POST",
  1449. // "id": "proximitybeacon.beacons.activate",
  1450. // "parameterOrder": [
  1451. // "beaconName"
  1452. // ],
  1453. // "parameters": {
  1454. // "beaconName": {
  1455. // "description": "Beacon that should be activated. A beacon name has the format\n\"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast by\nthe beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID or the beacon's \"stable\" UID.\nRequired.",
  1456. // "location": "path",
  1457. // "pattern": "^beacons/[^/]+$",
  1458. // "required": true,
  1459. // "type": "string"
  1460. // },
  1461. // "projectId": {
  1462. // "description": "The project id of the beacon to activate. If the project id is not\nspecified then the project making the request is used. The project id\nmust match the project that owns the beacon.\nOptional.",
  1463. // "location": "query",
  1464. // "type": "string"
  1465. // }
  1466. // },
  1467. // "path": "v1beta1/{+beaconName}:activate",
  1468. // "response": {
  1469. // "$ref": "Empty"
  1470. // },
  1471. // "scopes": [
  1472. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  1473. // ]
  1474. // }
  1475. }
  1476. // method id "proximitybeacon.beacons.deactivate":
  1477. type BeaconsDeactivateCall struct {
  1478. s *Service
  1479. beaconName string
  1480. urlParams_ gensupport.URLParams
  1481. ctx_ context.Context
  1482. header_ http.Header
  1483. }
  1484. // Deactivate: Deactivates a beacon. Once deactivated, the API will not
  1485. // return
  1486. // information nor attachment data for the beacon when queried
  1487. // via
  1488. // `beaconinfo.getforobserved`. Calling this method on an already
  1489. // inactive
  1490. // beacon will do nothing (but will return a successful response
  1491. // code).
  1492. //
  1493. // Authenticate using an [OAuth access
  1494. // token](https://developers.google.com/identity/protocols/OAuth2)
  1495. // from a signed-in user with **Is owner** or **Can edit** permissions
  1496. // in the
  1497. // Google Developers Console project.
  1498. func (r *BeaconsService) Deactivate(beaconName string) *BeaconsDeactivateCall {
  1499. c := &BeaconsDeactivateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1500. c.beaconName = beaconName
  1501. return c
  1502. }
  1503. // ProjectId sets the optional parameter "projectId": The project id of
  1504. // the beacon to deactivate. If the project id is not
  1505. // specified then the project making the request is used. The project id
  1506. // must
  1507. // match the project that owns the beacon.
  1508. func (c *BeaconsDeactivateCall) ProjectId(projectId string) *BeaconsDeactivateCall {
  1509. c.urlParams_.Set("projectId", projectId)
  1510. return c
  1511. }
  1512. // Fields allows partial responses to be retrieved. See
  1513. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1514. // for more information.
  1515. func (c *BeaconsDeactivateCall) Fields(s ...googleapi.Field) *BeaconsDeactivateCall {
  1516. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1517. return c
  1518. }
  1519. // Context sets the context to be used in this call's Do method. Any
  1520. // pending HTTP request will be aborted if the provided context is
  1521. // canceled.
  1522. func (c *BeaconsDeactivateCall) Context(ctx context.Context) *BeaconsDeactivateCall {
  1523. c.ctx_ = ctx
  1524. return c
  1525. }
  1526. // Header returns an http.Header that can be modified by the caller to
  1527. // add HTTP headers to the request.
  1528. func (c *BeaconsDeactivateCall) Header() http.Header {
  1529. if c.header_ == nil {
  1530. c.header_ = make(http.Header)
  1531. }
  1532. return c.header_
  1533. }
  1534. func (c *BeaconsDeactivateCall) doRequest(alt string) (*http.Response, error) {
  1535. reqHeaders := make(http.Header)
  1536. for k, v := range c.header_ {
  1537. reqHeaders[k] = v
  1538. }
  1539. reqHeaders.Set("User-Agent", c.s.userAgent())
  1540. var body io.Reader = nil
  1541. c.urlParams_.Set("alt", alt)
  1542. c.urlParams_.Set("prettyPrint", "false")
  1543. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}:deactivate")
  1544. urls += "?" + c.urlParams_.Encode()
  1545. req, err := http.NewRequest("POST", urls, body)
  1546. if err != nil {
  1547. return nil, err
  1548. }
  1549. req.Header = reqHeaders
  1550. googleapi.Expand(req.URL, map[string]string{
  1551. "beaconName": c.beaconName,
  1552. })
  1553. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1554. }
  1555. // Do executes the "proximitybeacon.beacons.deactivate" call.
  1556. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1557. // code is an error. Response headers are in either
  1558. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1559. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1560. // check whether the returned error was because http.StatusNotModified
  1561. // was returned.
  1562. func (c *BeaconsDeactivateCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1563. gensupport.SetOptions(c.urlParams_, opts...)
  1564. res, err := c.doRequest("json")
  1565. if res != nil && res.StatusCode == http.StatusNotModified {
  1566. if res.Body != nil {
  1567. res.Body.Close()
  1568. }
  1569. return nil, &googleapi.Error{
  1570. Code: res.StatusCode,
  1571. Header: res.Header,
  1572. }
  1573. }
  1574. if err != nil {
  1575. return nil, err
  1576. }
  1577. defer googleapi.CloseBody(res)
  1578. if err := googleapi.CheckResponse(res); err != nil {
  1579. return nil, err
  1580. }
  1581. ret := &Empty{
  1582. ServerResponse: googleapi.ServerResponse{
  1583. Header: res.Header,
  1584. HTTPStatusCode: res.StatusCode,
  1585. },
  1586. }
  1587. target := &ret
  1588. if err := gensupport.DecodeResponse(target, res); err != nil {
  1589. return nil, err
  1590. }
  1591. return ret, nil
  1592. // {
  1593. // "description": "Deactivates a beacon. Once deactivated, the API will not return\ninformation nor attachment data for the beacon when queried via\n`beaconinfo.getforobserved`. Calling this method on an already inactive\nbeacon will do nothing (but will return a successful response code).\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  1594. // "flatPath": "v1beta1/beacons/{beaconsId}:deactivate",
  1595. // "httpMethod": "POST",
  1596. // "id": "proximitybeacon.beacons.deactivate",
  1597. // "parameterOrder": [
  1598. // "beaconName"
  1599. // ],
  1600. // "parameters": {
  1601. // "beaconName": {
  1602. // "description": "Beacon that should be deactivated. A beacon name has the format\n\"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast by\nthe beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID or the beacon's \"stable\" UID.\nRequired.",
  1603. // "location": "path",
  1604. // "pattern": "^beacons/[^/]+$",
  1605. // "required": true,
  1606. // "type": "string"
  1607. // },
  1608. // "projectId": {
  1609. // "description": "The project id of the beacon to deactivate. If the project id is not\nspecified then the project making the request is used. The project id must\nmatch the project that owns the beacon.\nOptional.",
  1610. // "location": "query",
  1611. // "type": "string"
  1612. // }
  1613. // },
  1614. // "path": "v1beta1/{+beaconName}:deactivate",
  1615. // "response": {
  1616. // "$ref": "Empty"
  1617. // },
  1618. // "scopes": [
  1619. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  1620. // ]
  1621. // }
  1622. }
  1623. // method id "proximitybeacon.beacons.decommission":
  1624. type BeaconsDecommissionCall struct {
  1625. s *Service
  1626. beaconName string
  1627. urlParams_ gensupport.URLParams
  1628. ctx_ context.Context
  1629. header_ http.Header
  1630. }
  1631. // Decommission: Decommissions the specified beacon in the service. This
  1632. // beacon will no
  1633. // longer be returned from `beaconinfo.getforobserved`. This operation
  1634. // is
  1635. // permanent -- you will not be able to re-register a beacon with this
  1636. // ID
  1637. // again.
  1638. //
  1639. // Authenticate using an [OAuth access
  1640. // token](https://developers.google.com/identity/protocols/OAuth2)
  1641. // from a signed-in user with **Is owner** or **Can edit** permissions
  1642. // in the
  1643. // Google Developers Console project.
  1644. func (r *BeaconsService) Decommission(beaconName string) *BeaconsDecommissionCall {
  1645. c := &BeaconsDecommissionCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1646. c.beaconName = beaconName
  1647. return c
  1648. }
  1649. // ProjectId sets the optional parameter "projectId": The project id of
  1650. // the beacon to decommission. If the project id is not
  1651. // specified then the project making the request is used. The project
  1652. // id
  1653. // must match the project that owns the beacon.
  1654. func (c *BeaconsDecommissionCall) ProjectId(projectId string) *BeaconsDecommissionCall {
  1655. c.urlParams_.Set("projectId", projectId)
  1656. return c
  1657. }
  1658. // Fields allows partial responses to be retrieved. See
  1659. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1660. // for more information.
  1661. func (c *BeaconsDecommissionCall) Fields(s ...googleapi.Field) *BeaconsDecommissionCall {
  1662. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1663. return c
  1664. }
  1665. // Context sets the context to be used in this call's Do method. Any
  1666. // pending HTTP request will be aborted if the provided context is
  1667. // canceled.
  1668. func (c *BeaconsDecommissionCall) Context(ctx context.Context) *BeaconsDecommissionCall {
  1669. c.ctx_ = ctx
  1670. return c
  1671. }
  1672. // Header returns an http.Header that can be modified by the caller to
  1673. // add HTTP headers to the request.
  1674. func (c *BeaconsDecommissionCall) Header() http.Header {
  1675. if c.header_ == nil {
  1676. c.header_ = make(http.Header)
  1677. }
  1678. return c.header_
  1679. }
  1680. func (c *BeaconsDecommissionCall) doRequest(alt string) (*http.Response, error) {
  1681. reqHeaders := make(http.Header)
  1682. for k, v := range c.header_ {
  1683. reqHeaders[k] = v
  1684. }
  1685. reqHeaders.Set("User-Agent", c.s.userAgent())
  1686. var body io.Reader = nil
  1687. c.urlParams_.Set("alt", alt)
  1688. c.urlParams_.Set("prettyPrint", "false")
  1689. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}:decommission")
  1690. urls += "?" + c.urlParams_.Encode()
  1691. req, err := http.NewRequest("POST", urls, body)
  1692. if err != nil {
  1693. return nil, err
  1694. }
  1695. req.Header = reqHeaders
  1696. googleapi.Expand(req.URL, map[string]string{
  1697. "beaconName": c.beaconName,
  1698. })
  1699. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1700. }
  1701. // Do executes the "proximitybeacon.beacons.decommission" call.
  1702. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1703. // code is an error. Response headers are in either
  1704. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1705. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1706. // check whether the returned error was because http.StatusNotModified
  1707. // was returned.
  1708. func (c *BeaconsDecommissionCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1709. gensupport.SetOptions(c.urlParams_, opts...)
  1710. res, err := c.doRequest("json")
  1711. if res != nil && res.StatusCode == http.StatusNotModified {
  1712. if res.Body != nil {
  1713. res.Body.Close()
  1714. }
  1715. return nil, &googleapi.Error{
  1716. Code: res.StatusCode,
  1717. Header: res.Header,
  1718. }
  1719. }
  1720. if err != nil {
  1721. return nil, err
  1722. }
  1723. defer googleapi.CloseBody(res)
  1724. if err := googleapi.CheckResponse(res); err != nil {
  1725. return nil, err
  1726. }
  1727. ret := &Empty{
  1728. ServerResponse: googleapi.ServerResponse{
  1729. Header: res.Header,
  1730. HTTPStatusCode: res.StatusCode,
  1731. },
  1732. }
  1733. target := &ret
  1734. if err := gensupport.DecodeResponse(target, res); err != nil {
  1735. return nil, err
  1736. }
  1737. return ret, nil
  1738. // {
  1739. // "description": "Decommissions the specified beacon in the service. This beacon will no\nlonger be returned from `beaconinfo.getforobserved`. This operation is\npermanent -- you will not be able to re-register a beacon with this ID\nagain.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  1740. // "flatPath": "v1beta1/beacons/{beaconsId}:decommission",
  1741. // "httpMethod": "POST",
  1742. // "id": "proximitybeacon.beacons.decommission",
  1743. // "parameterOrder": [
  1744. // "beaconName"
  1745. // ],
  1746. // "parameters": {
  1747. // "beaconName": {
  1748. // "description": "Beacon that should be decommissioned. A beacon name has the format\n\"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast by\nthe beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID of the beacon's \"stable\" UID.\nRequired.",
  1749. // "location": "path",
  1750. // "pattern": "^beacons/[^/]+$",
  1751. // "required": true,
  1752. // "type": "string"
  1753. // },
  1754. // "projectId": {
  1755. // "description": "The project id of the beacon to decommission. If the project id is not\nspecified then the project making the request is used. The project id\nmust match the project that owns the beacon.\nOptional.",
  1756. // "location": "query",
  1757. // "type": "string"
  1758. // }
  1759. // },
  1760. // "path": "v1beta1/{+beaconName}:decommission",
  1761. // "response": {
  1762. // "$ref": "Empty"
  1763. // },
  1764. // "scopes": [
  1765. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  1766. // ]
  1767. // }
  1768. }
  1769. // method id "proximitybeacon.beacons.delete":
  1770. type BeaconsDeleteCall struct {
  1771. s *Service
  1772. beaconName string
  1773. urlParams_ gensupport.URLParams
  1774. ctx_ context.Context
  1775. header_ http.Header
  1776. }
  1777. // Delete: Deletes the specified beacon including all diagnostics data
  1778. // for the beacon
  1779. // as well as any attachments on the beacon (including those belonging
  1780. // to
  1781. // other projects). This operation cannot be undone.
  1782. //
  1783. // Authenticate using an [OAuth access
  1784. // token](https://developers.google.com/identity/protocols/OAuth2)
  1785. // from a signed-in user with **Is owner** or **Can edit** permissions
  1786. // in the
  1787. // Google Developers Console project.
  1788. func (r *BeaconsService) Delete(beaconName string) *BeaconsDeleteCall {
  1789. c := &BeaconsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1790. c.beaconName = beaconName
  1791. return c
  1792. }
  1793. // ProjectId sets the optional parameter "projectId": The project id of
  1794. // the beacon to delete. If not provided, the project
  1795. // that is making the request is used.
  1796. func (c *BeaconsDeleteCall) ProjectId(projectId string) *BeaconsDeleteCall {
  1797. c.urlParams_.Set("projectId", projectId)
  1798. return c
  1799. }
  1800. // Fields allows partial responses to be retrieved. See
  1801. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1802. // for more information.
  1803. func (c *BeaconsDeleteCall) Fields(s ...googleapi.Field) *BeaconsDeleteCall {
  1804. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1805. return c
  1806. }
  1807. // Context sets the context to be used in this call's Do method. Any
  1808. // pending HTTP request will be aborted if the provided context is
  1809. // canceled.
  1810. func (c *BeaconsDeleteCall) Context(ctx context.Context) *BeaconsDeleteCall {
  1811. c.ctx_ = ctx
  1812. return c
  1813. }
  1814. // Header returns an http.Header that can be modified by the caller to
  1815. // add HTTP headers to the request.
  1816. func (c *BeaconsDeleteCall) Header() http.Header {
  1817. if c.header_ == nil {
  1818. c.header_ = make(http.Header)
  1819. }
  1820. return c.header_
  1821. }
  1822. func (c *BeaconsDeleteCall) doRequest(alt string) (*http.Response, error) {
  1823. reqHeaders := make(http.Header)
  1824. for k, v := range c.header_ {
  1825. reqHeaders[k] = v
  1826. }
  1827. reqHeaders.Set("User-Agent", c.s.userAgent())
  1828. var body io.Reader = nil
  1829. c.urlParams_.Set("alt", alt)
  1830. c.urlParams_.Set("prettyPrint", "false")
  1831. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}")
  1832. urls += "?" + c.urlParams_.Encode()
  1833. req, err := http.NewRequest("DELETE", urls, body)
  1834. if err != nil {
  1835. return nil, err
  1836. }
  1837. req.Header = reqHeaders
  1838. googleapi.Expand(req.URL, map[string]string{
  1839. "beaconName": c.beaconName,
  1840. })
  1841. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1842. }
  1843. // Do executes the "proximitybeacon.beacons.delete" call.
  1844. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  1845. // code is an error. Response headers are in either
  1846. // *Empty.ServerResponse.Header or (if a response was returned at all)
  1847. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1848. // check whether the returned error was because http.StatusNotModified
  1849. // was returned.
  1850. func (c *BeaconsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  1851. gensupport.SetOptions(c.urlParams_, opts...)
  1852. res, err := c.doRequest("json")
  1853. if res != nil && res.StatusCode == http.StatusNotModified {
  1854. if res.Body != nil {
  1855. res.Body.Close()
  1856. }
  1857. return nil, &googleapi.Error{
  1858. Code: res.StatusCode,
  1859. Header: res.Header,
  1860. }
  1861. }
  1862. if err != nil {
  1863. return nil, err
  1864. }
  1865. defer googleapi.CloseBody(res)
  1866. if err := googleapi.CheckResponse(res); err != nil {
  1867. return nil, err
  1868. }
  1869. ret := &Empty{
  1870. ServerResponse: googleapi.ServerResponse{
  1871. Header: res.Header,
  1872. HTTPStatusCode: res.StatusCode,
  1873. },
  1874. }
  1875. target := &ret
  1876. if err := gensupport.DecodeResponse(target, res); err != nil {
  1877. return nil, err
  1878. }
  1879. return ret, nil
  1880. // {
  1881. // "description": "Deletes the specified beacon including all diagnostics data for the beacon\nas well as any attachments on the beacon (including those belonging to\nother projects). This operation cannot be undone.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  1882. // "flatPath": "v1beta1/beacons/{beaconsId}",
  1883. // "httpMethod": "DELETE",
  1884. // "id": "proximitybeacon.beacons.delete",
  1885. // "parameterOrder": [
  1886. // "beaconName"
  1887. // ],
  1888. // "parameters": {
  1889. // "beaconName": {
  1890. // "description": "Beacon that should be deleted. A beacon name has the format\n\"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast by\nthe beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID or the beacon's \"stable\" UID.\nRequired.",
  1891. // "location": "path",
  1892. // "pattern": "^beacons/[^/]+$",
  1893. // "required": true,
  1894. // "type": "string"
  1895. // },
  1896. // "projectId": {
  1897. // "description": "The project id of the beacon to delete. If not provided, the project\nthat is making the request is used.\nOptional.",
  1898. // "location": "query",
  1899. // "type": "string"
  1900. // }
  1901. // },
  1902. // "path": "v1beta1/{+beaconName}",
  1903. // "response": {
  1904. // "$ref": "Empty"
  1905. // },
  1906. // "scopes": [
  1907. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  1908. // ]
  1909. // }
  1910. }
  1911. // method id "proximitybeacon.beacons.get":
  1912. type BeaconsGetCall struct {
  1913. s *Service
  1914. beaconName string
  1915. urlParams_ gensupport.URLParams
  1916. ifNoneMatch_ string
  1917. ctx_ context.Context
  1918. header_ http.Header
  1919. }
  1920. // Get: Returns detailed information about the specified
  1921. // beacon.
  1922. //
  1923. // Authenticate using an [OAuth access
  1924. // token](https://developers.google.com/identity/protocols/OAuth2)
  1925. // from a signed-in user with **viewer**, **Is owner** or **Can
  1926. // edit**
  1927. // permissions in the Google Developers Console project.
  1928. //
  1929. // Requests may supply an Eddystone-EID beacon name in the
  1930. // form:
  1931. // `beacons/4!beaconId` where the `beaconId` is the base16 ephemeral
  1932. // ID
  1933. // broadcast by the beacon. The returned `Beacon` object will contain
  1934. // the
  1935. // beacon's stable Eddystone-UID. Clients not authorized to resolve
  1936. // the
  1937. // beacon's ephemeral Eddystone-EID broadcast will receive an error.
  1938. func (r *BeaconsService) Get(beaconName string) *BeaconsGetCall {
  1939. c := &BeaconsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1940. c.beaconName = beaconName
  1941. return c
  1942. }
  1943. // ProjectId sets the optional parameter "projectId": The project id of
  1944. // the beacon to request. If the project id is not specified
  1945. // then the project making the request is used. The project id must
  1946. // match the
  1947. // project that owns the beacon.
  1948. func (c *BeaconsGetCall) ProjectId(projectId string) *BeaconsGetCall {
  1949. c.urlParams_.Set("projectId", projectId)
  1950. return c
  1951. }
  1952. // Fields allows partial responses to be retrieved. See
  1953. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1954. // for more information.
  1955. func (c *BeaconsGetCall) Fields(s ...googleapi.Field) *BeaconsGetCall {
  1956. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1957. return c
  1958. }
  1959. // IfNoneMatch sets the optional parameter which makes the operation
  1960. // fail if the object's ETag matches the given value. This is useful for
  1961. // getting updates only after the object has changed since the last
  1962. // request. Use googleapi.IsNotModified to check whether the response
  1963. // error from Do is the result of In-None-Match.
  1964. func (c *BeaconsGetCall) IfNoneMatch(entityTag string) *BeaconsGetCall {
  1965. c.ifNoneMatch_ = entityTag
  1966. return c
  1967. }
  1968. // Context sets the context to be used in this call's Do method. Any
  1969. // pending HTTP request will be aborted if the provided context is
  1970. // canceled.
  1971. func (c *BeaconsGetCall) Context(ctx context.Context) *BeaconsGetCall {
  1972. c.ctx_ = ctx
  1973. return c
  1974. }
  1975. // Header returns an http.Header that can be modified by the caller to
  1976. // add HTTP headers to the request.
  1977. func (c *BeaconsGetCall) Header() http.Header {
  1978. if c.header_ == nil {
  1979. c.header_ = make(http.Header)
  1980. }
  1981. return c.header_
  1982. }
  1983. func (c *BeaconsGetCall) doRequest(alt string) (*http.Response, error) {
  1984. reqHeaders := make(http.Header)
  1985. for k, v := range c.header_ {
  1986. reqHeaders[k] = v
  1987. }
  1988. reqHeaders.Set("User-Agent", c.s.userAgent())
  1989. if c.ifNoneMatch_ != "" {
  1990. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1991. }
  1992. var body io.Reader = nil
  1993. c.urlParams_.Set("alt", alt)
  1994. c.urlParams_.Set("prettyPrint", "false")
  1995. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}")
  1996. urls += "?" + c.urlParams_.Encode()
  1997. req, err := http.NewRequest("GET", urls, body)
  1998. if err != nil {
  1999. return nil, err
  2000. }
  2001. req.Header = reqHeaders
  2002. googleapi.Expand(req.URL, map[string]string{
  2003. "beaconName": c.beaconName,
  2004. })
  2005. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2006. }
  2007. // Do executes the "proximitybeacon.beacons.get" call.
  2008. // Exactly one of *Beacon or error will be non-nil. Any non-2xx status
  2009. // code is an error. Response headers are in either
  2010. // *Beacon.ServerResponse.Header or (if a response was returned at all)
  2011. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2012. // check whether the returned error was because http.StatusNotModified
  2013. // was returned.
  2014. func (c *BeaconsGetCall) Do(opts ...googleapi.CallOption) (*Beacon, error) {
  2015. gensupport.SetOptions(c.urlParams_, opts...)
  2016. res, err := c.doRequest("json")
  2017. if res != nil && res.StatusCode == http.StatusNotModified {
  2018. if res.Body != nil {
  2019. res.Body.Close()
  2020. }
  2021. return nil, &googleapi.Error{
  2022. Code: res.StatusCode,
  2023. Header: res.Header,
  2024. }
  2025. }
  2026. if err != nil {
  2027. return nil, err
  2028. }
  2029. defer googleapi.CloseBody(res)
  2030. if err := googleapi.CheckResponse(res); err != nil {
  2031. return nil, err
  2032. }
  2033. ret := &Beacon{
  2034. ServerResponse: googleapi.ServerResponse{
  2035. Header: res.Header,
  2036. HTTPStatusCode: res.StatusCode,
  2037. },
  2038. }
  2039. target := &ret
  2040. if err := gensupport.DecodeResponse(target, res); err != nil {
  2041. return nil, err
  2042. }
  2043. return ret, nil
  2044. // {
  2045. // "description": "Returns detailed information about the specified beacon.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **viewer**, **Is owner** or **Can edit**\npermissions in the Google Developers Console project.\n\nRequests may supply an Eddystone-EID beacon name in the form:\n`beacons/4!beaconId` where the `beaconId` is the base16 ephemeral ID\nbroadcast by the beacon. The returned `Beacon` object will contain the\nbeacon's stable Eddystone-UID. Clients not authorized to resolve the\nbeacon's ephemeral Eddystone-EID broadcast will receive an error.",
  2046. // "flatPath": "v1beta1/beacons/{beaconsId}",
  2047. // "httpMethod": "GET",
  2048. // "id": "proximitybeacon.beacons.get",
  2049. // "parameterOrder": [
  2050. // "beaconName"
  2051. // ],
  2052. // "parameters": {
  2053. // "beaconName": {
  2054. // "description": "Resource name of this beacon. A beacon name has the format\n\"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast by\nthe beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID or the beacon's \"stable\" UID.\nRequired.",
  2055. // "location": "path",
  2056. // "pattern": "^beacons/[^/]+$",
  2057. // "required": true,
  2058. // "type": "string"
  2059. // },
  2060. // "projectId": {
  2061. // "description": "The project id of the beacon to request. If the project id is not specified\nthen the project making the request is used. The project id must match the\nproject that owns the beacon.\nOptional.",
  2062. // "location": "query",
  2063. // "type": "string"
  2064. // }
  2065. // },
  2066. // "path": "v1beta1/{+beaconName}",
  2067. // "response": {
  2068. // "$ref": "Beacon"
  2069. // },
  2070. // "scopes": [
  2071. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  2072. // ]
  2073. // }
  2074. }
  2075. // method id "proximitybeacon.beacons.list":
  2076. type BeaconsListCall struct {
  2077. s *Service
  2078. urlParams_ gensupport.URLParams
  2079. ifNoneMatch_ string
  2080. ctx_ context.Context
  2081. header_ http.Header
  2082. }
  2083. // List: Searches the beacon registry for beacons that match the given
  2084. // search
  2085. // criteria. Only those beacons that the client has permission to
  2086. // list
  2087. // will be returned.
  2088. //
  2089. // Authenticate using an [OAuth access
  2090. // token](https://developers.google.com/identity/protocols/OAuth2)
  2091. // from a signed-in user with **viewer**, **Is owner** or **Can
  2092. // edit**
  2093. // permissions in the Google Developers Console project.
  2094. func (r *BeaconsService) List() *BeaconsListCall {
  2095. c := &BeaconsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2096. return c
  2097. }
  2098. // PageSize sets the optional parameter "pageSize": The maximum number
  2099. // of records to return for this request, up to a
  2100. // server-defined upper limit.
  2101. func (c *BeaconsListCall) PageSize(pageSize int64) *BeaconsListCall {
  2102. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2103. return c
  2104. }
  2105. // PageToken sets the optional parameter "pageToken": A pagination token
  2106. // obtained from a previous request to list beacons.
  2107. func (c *BeaconsListCall) PageToken(pageToken string) *BeaconsListCall {
  2108. c.urlParams_.Set("pageToken", pageToken)
  2109. return c
  2110. }
  2111. // ProjectId sets the optional parameter "projectId": The project id to
  2112. // list beacons under. If not present then the project
  2113. // credential that made the request is used as the project.
  2114. func (c *BeaconsListCall) ProjectId(projectId string) *BeaconsListCall {
  2115. c.urlParams_.Set("projectId", projectId)
  2116. return c
  2117. }
  2118. // Q sets the optional parameter "q": Filter query string that supports
  2119. // the following field filters:
  2120. //
  2121. // * **description:"<string>"**
  2122. // For example: **description:"Room 3"**
  2123. // Returns beacons whose description matches tokens in the string
  2124. // "Room 3"
  2125. // (not necessarily that exact string).
  2126. // The string must be double-quoted.
  2127. // * **status:`<enum>`**
  2128. // For example: **status:active**
  2129. // Returns beacons whose status matches the given value. Values must
  2130. // be
  2131. // one of the Beacon.Status enum values (case insensitive). Accepts
  2132. // multiple filters which will be combined with OR logic.
  2133. // * **stability:`<enum>`**
  2134. // For example: **stability:mobile**
  2135. // Returns beacons whose expected stability matches the given value.
  2136. // Values must be one of the Beacon.Stability enum values (case
  2137. // insensitive). Accepts multiple filters which will be combined with
  2138. // OR logic.
  2139. // * **place\_id:"<string>"**
  2140. // For example: **place\_id:"ChIJVSZzVR8FdkgRXGmmm6SslKw="**
  2141. // Returns beacons explicitly registered at the given place, expressed
  2142. // as
  2143. // a Place ID obtained from [Google Places API](/places/place-id).
  2144. // Does not
  2145. // match places inside the given place. Does not consider the
  2146. // beacon's
  2147. // actual location (which may be different from its registered
  2148. // place).
  2149. // Accepts multiple filters that will be combined with OR logic. The
  2150. // place
  2151. // ID must be double-quoted.
  2152. // * **registration\_time`[<|>|<=|>=]<integer>`**
  2153. // For example: **registration\_time>=1433116800**
  2154. // Returns beacons whose registration time matches the given filter.
  2155. // Supports the operators: <, >, <=, and >=. Timestamp must be
  2156. // expressed as
  2157. // an integer number of seconds since midnight January 1, 1970 UTC.
  2158. // Accepts
  2159. // at most two filters that will be combined with AND logic, to
  2160. // support
  2161. // "between" semantics. If more than two are supplied, the latter ones
  2162. // are
  2163. // ignored.
  2164. // * **lat:`<double> lng:<double> radius:<integer>`**
  2165. // For example: **lat:51.1232343 lng:-1.093852 radius:1000**
  2166. // Returns beacons whose registered location is within the given
  2167. // circle.
  2168. // When any of these fields are given, all are required. Latitude and
  2169. // longitude must be decimal degrees between -90.0 and 90.0 and
  2170. // between
  2171. // -180.0 and 180.0 respectively. Radius must be an integer number of
  2172. // meters between 10 and 1,000,000 (1000 km).
  2173. // * **property:"<string>=<string>"**
  2174. // For example: **property:"battery-type=CR2032"**
  2175. // Returns beacons which have a property of the given name and value.
  2176. // Supports multiple filters which will be combined with OR logic.
  2177. // The entire name=value string must be double-quoted as one string.
  2178. // * **attachment\_type:"<string>"**
  2179. // For example: **attachment_type:"my-namespace/my-type"**
  2180. // Returns beacons having at least one attachment of the given
  2181. // namespaced
  2182. // type. Supports "any within this namespace" via the partial
  2183. // wildcard
  2184. // syntax: "my-namespace/*". Supports multiple filters which will be
  2185. // combined with OR logic. The string must be double-quoted.
  2186. // * **indoor\_level:"<string>"**
  2187. // For example: **indoor\_level:"1"**
  2188. // Returns beacons which are located on the given indoor level.
  2189. // Accepts
  2190. // multiple filters that will be combined with OR logic.
  2191. //
  2192. // Multiple filters on the same field are combined with OR logic
  2193. // (except
  2194. // registration_time which is combined with AND logic).
  2195. // Multiple filters on different fields are combined with AND
  2196. // logic.
  2197. // Filters should be separated by spaces.
  2198. //
  2199. // As with any HTTP query string parameter, the whole filter expression
  2200. // must
  2201. // be URL-encoded.
  2202. //
  2203. // Example REST request:
  2204. // `GET
  2205. // /v1beta1/beacons?q=status:active%20lat:51.123%20lng:-1.095%20radius:10
  2206. // 00`
  2207. func (c *BeaconsListCall) Q(q string) *BeaconsListCall {
  2208. c.urlParams_.Set("q", q)
  2209. return c
  2210. }
  2211. // Fields allows partial responses to be retrieved. See
  2212. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2213. // for more information.
  2214. func (c *BeaconsListCall) Fields(s ...googleapi.Field) *BeaconsListCall {
  2215. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2216. return c
  2217. }
  2218. // IfNoneMatch sets the optional parameter which makes the operation
  2219. // fail if the object's ETag matches the given value. This is useful for
  2220. // getting updates only after the object has changed since the last
  2221. // request. Use googleapi.IsNotModified to check whether the response
  2222. // error from Do is the result of In-None-Match.
  2223. func (c *BeaconsListCall) IfNoneMatch(entityTag string) *BeaconsListCall {
  2224. c.ifNoneMatch_ = entityTag
  2225. return c
  2226. }
  2227. // Context sets the context to be used in this call's Do method. Any
  2228. // pending HTTP request will be aborted if the provided context is
  2229. // canceled.
  2230. func (c *BeaconsListCall) Context(ctx context.Context) *BeaconsListCall {
  2231. c.ctx_ = ctx
  2232. return c
  2233. }
  2234. // Header returns an http.Header that can be modified by the caller to
  2235. // add HTTP headers to the request.
  2236. func (c *BeaconsListCall) Header() http.Header {
  2237. if c.header_ == nil {
  2238. c.header_ = make(http.Header)
  2239. }
  2240. return c.header_
  2241. }
  2242. func (c *BeaconsListCall) doRequest(alt string) (*http.Response, error) {
  2243. reqHeaders := make(http.Header)
  2244. for k, v := range c.header_ {
  2245. reqHeaders[k] = v
  2246. }
  2247. reqHeaders.Set("User-Agent", c.s.userAgent())
  2248. if c.ifNoneMatch_ != "" {
  2249. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2250. }
  2251. var body io.Reader = nil
  2252. c.urlParams_.Set("alt", alt)
  2253. c.urlParams_.Set("prettyPrint", "false")
  2254. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/beacons")
  2255. urls += "?" + c.urlParams_.Encode()
  2256. req, err := http.NewRequest("GET", urls, body)
  2257. if err != nil {
  2258. return nil, err
  2259. }
  2260. req.Header = reqHeaders
  2261. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2262. }
  2263. // Do executes the "proximitybeacon.beacons.list" call.
  2264. // Exactly one of *ListBeaconsResponse or error will be non-nil. Any
  2265. // non-2xx status code is an error. Response headers are in either
  2266. // *ListBeaconsResponse.ServerResponse.Header or (if a response was
  2267. // returned at all) in error.(*googleapi.Error).Header. Use
  2268. // googleapi.IsNotModified to check whether the returned error was
  2269. // because http.StatusNotModified was returned.
  2270. func (c *BeaconsListCall) Do(opts ...googleapi.CallOption) (*ListBeaconsResponse, error) {
  2271. gensupport.SetOptions(c.urlParams_, opts...)
  2272. res, err := c.doRequest("json")
  2273. if res != nil && res.StatusCode == http.StatusNotModified {
  2274. if res.Body != nil {
  2275. res.Body.Close()
  2276. }
  2277. return nil, &googleapi.Error{
  2278. Code: res.StatusCode,
  2279. Header: res.Header,
  2280. }
  2281. }
  2282. if err != nil {
  2283. return nil, err
  2284. }
  2285. defer googleapi.CloseBody(res)
  2286. if err := googleapi.CheckResponse(res); err != nil {
  2287. return nil, err
  2288. }
  2289. ret := &ListBeaconsResponse{
  2290. ServerResponse: googleapi.ServerResponse{
  2291. Header: res.Header,
  2292. HTTPStatusCode: res.StatusCode,
  2293. },
  2294. }
  2295. target := &ret
  2296. if err := gensupport.DecodeResponse(target, res); err != nil {
  2297. return nil, err
  2298. }
  2299. return ret, nil
  2300. // {
  2301. // "description": "Searches the beacon registry for beacons that match the given search\ncriteria. Only those beacons that the client has permission to list\nwill be returned.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **viewer**, **Is owner** or **Can edit**\npermissions in the Google Developers Console project.",
  2302. // "flatPath": "v1beta1/beacons",
  2303. // "httpMethod": "GET",
  2304. // "id": "proximitybeacon.beacons.list",
  2305. // "parameterOrder": [],
  2306. // "parameters": {
  2307. // "pageSize": {
  2308. // "description": "The maximum number of records to return for this request, up to a\nserver-defined upper limit.",
  2309. // "format": "int32",
  2310. // "location": "query",
  2311. // "type": "integer"
  2312. // },
  2313. // "pageToken": {
  2314. // "description": "A pagination token obtained from a previous request to list beacons.",
  2315. // "location": "query",
  2316. // "type": "string"
  2317. // },
  2318. // "projectId": {
  2319. // "description": "The project id to list beacons under. If not present then the project\ncredential that made the request is used as the project.\nOptional.",
  2320. // "location": "query",
  2321. // "type": "string"
  2322. // },
  2323. // "q": {
  2324. // "description": "Filter query string that supports the following field filters:\n\n* **description:`\"\u003cstring\u003e\"`**\n For example: **description:\"Room 3\"**\n Returns beacons whose description matches tokens in the string \"Room 3\"\n (not necessarily that exact string).\n The string must be double-quoted.\n* **status:`\u003cenum\u003e`**\n For example: **status:active**\n Returns beacons whose status matches the given value. Values must be\n one of the Beacon.Status enum values (case insensitive). Accepts\n multiple filters which will be combined with OR logic.\n* **stability:`\u003cenum\u003e`**\n For example: **stability:mobile**\n Returns beacons whose expected stability matches the given value.\n Values must be one of the Beacon.Stability enum values (case\n insensitive). Accepts multiple filters which will be combined with\n OR logic.\n* **place\\_id:`\"\u003cstring\u003e\"`**\n For example: **place\\_id:\"ChIJVSZzVR8FdkgRXGmmm6SslKw=\"**\n Returns beacons explicitly registered at the given place, expressed as\n a Place ID obtained from [Google Places API](/places/place-id). Does not\n match places inside the given place. Does not consider the beacon's\n actual location (which may be different from its registered place).\n Accepts multiple filters that will be combined with OR logic. The place\n ID must be double-quoted.\n* **registration\\_time`[\u003c|\u003e|\u003c=|\u003e=]\u003cinteger\u003e`**\n For example: **registration\\_time\u003e=1433116800**\n Returns beacons whose registration time matches the given filter.\n Supports the operators: \u003c, \u003e, \u003c=, and \u003e=. Timestamp must be expressed as\n an integer number of seconds since midnight January 1, 1970 UTC. Accepts\n at most two filters that will be combined with AND logic, to support\n \"between\" semantics. If more than two are supplied, the latter ones are\n ignored.\n* **lat:`\u003cdouble\u003e lng:\u003cdouble\u003e radius:\u003cinteger\u003e`**\n For example: **lat:51.1232343 lng:-1.093852 radius:1000**\n Returns beacons whose registered location is within the given circle.\n When any of these fields are given, all are required. Latitude and\n longitude must be decimal degrees between -90.0 and 90.0 and between\n -180.0 and 180.0 respectively. Radius must be an integer number of\n meters between 10 and 1,000,000 (1000 km).\n* **property:`\"\u003cstring\u003e=\u003cstring\u003e\"`**\n For example: **property:\"battery-type=CR2032\"**\n Returns beacons which have a property of the given name and value.\n Supports multiple filters which will be combined with OR logic.\n The entire name=value string must be double-quoted as one string.\n* **attachment\\_type:`\"\u003cstring\u003e\"`**\n For example: **attachment_type:\"my-namespace/my-type\"**\n Returns beacons having at least one attachment of the given namespaced\n type. Supports \"any within this namespace\" via the partial wildcard\n syntax: \"my-namespace/*\". Supports multiple filters which will be\n combined with OR logic. The string must be double-quoted.\n* **indoor\\_level:`\"\u003cstring\u003e\"`**\n For example: **indoor\\_level:\"1\"**\n Returns beacons which are located on the given indoor level. Accepts\n multiple filters that will be combined with OR logic.\n\nMultiple filters on the same field are combined with OR logic (except\nregistration_time which is combined with AND logic).\nMultiple filters on different fields are combined with AND logic.\nFilters should be separated by spaces.\n\nAs with any HTTP query string parameter, the whole filter expression must\nbe URL-encoded.\n\nExample REST request:\n`GET /v1beta1/beacons?q=status:active%20lat:51.123%20lng:-1.095%20radius:1000`",
  2325. // "location": "query",
  2326. // "type": "string"
  2327. // }
  2328. // },
  2329. // "path": "v1beta1/beacons",
  2330. // "response": {
  2331. // "$ref": "ListBeaconsResponse"
  2332. // },
  2333. // "scopes": [
  2334. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  2335. // ]
  2336. // }
  2337. }
  2338. // Pages invokes f for each page of results.
  2339. // A non-nil error returned from f will halt the iteration.
  2340. // The provided context supersedes any context provided to the Context method.
  2341. func (c *BeaconsListCall) Pages(ctx context.Context, f func(*ListBeaconsResponse) error) error {
  2342. c.ctx_ = ctx
  2343. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  2344. for {
  2345. x, err := c.Do()
  2346. if err != nil {
  2347. return err
  2348. }
  2349. if err := f(x); err != nil {
  2350. return err
  2351. }
  2352. if x.NextPageToken == "" {
  2353. return nil
  2354. }
  2355. c.PageToken(x.NextPageToken)
  2356. }
  2357. }
  2358. // method id "proximitybeacon.beacons.register":
  2359. type BeaconsRegisterCall struct {
  2360. s *Service
  2361. beacon *Beacon
  2362. urlParams_ gensupport.URLParams
  2363. ctx_ context.Context
  2364. header_ http.Header
  2365. }
  2366. // Register: Registers a previously unregistered beacon given its
  2367. // `advertisedId`.
  2368. // These IDs are unique within the system. An ID can be registered only
  2369. // once.
  2370. //
  2371. // Authenticate using an [OAuth access
  2372. // token](https://developers.google.com/identity/protocols/OAuth2)
  2373. // from a signed-in user with **Is owner** or **Can edit** permissions
  2374. // in the
  2375. // Google Developers Console project.
  2376. func (r *BeaconsService) Register(beacon *Beacon) *BeaconsRegisterCall {
  2377. c := &BeaconsRegisterCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2378. c.beacon = beacon
  2379. return c
  2380. }
  2381. // ProjectId sets the optional parameter "projectId": The project id of
  2382. // the project the beacon will be registered to. If
  2383. // the project id is not specified then the project making the
  2384. // request
  2385. // is used.
  2386. func (c *BeaconsRegisterCall) ProjectId(projectId string) *BeaconsRegisterCall {
  2387. c.urlParams_.Set("projectId", projectId)
  2388. return c
  2389. }
  2390. // Fields allows partial responses to be retrieved. See
  2391. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2392. // for more information.
  2393. func (c *BeaconsRegisterCall) Fields(s ...googleapi.Field) *BeaconsRegisterCall {
  2394. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2395. return c
  2396. }
  2397. // Context sets the context to be used in this call's Do method. Any
  2398. // pending HTTP request will be aborted if the provided context is
  2399. // canceled.
  2400. func (c *BeaconsRegisterCall) Context(ctx context.Context) *BeaconsRegisterCall {
  2401. c.ctx_ = ctx
  2402. return c
  2403. }
  2404. // Header returns an http.Header that can be modified by the caller to
  2405. // add HTTP headers to the request.
  2406. func (c *BeaconsRegisterCall) Header() http.Header {
  2407. if c.header_ == nil {
  2408. c.header_ = make(http.Header)
  2409. }
  2410. return c.header_
  2411. }
  2412. func (c *BeaconsRegisterCall) doRequest(alt string) (*http.Response, error) {
  2413. reqHeaders := make(http.Header)
  2414. for k, v := range c.header_ {
  2415. reqHeaders[k] = v
  2416. }
  2417. reqHeaders.Set("User-Agent", c.s.userAgent())
  2418. var body io.Reader = nil
  2419. body, err := googleapi.WithoutDataWrapper.JSONReader(c.beacon)
  2420. if err != nil {
  2421. return nil, err
  2422. }
  2423. reqHeaders.Set("Content-Type", "application/json")
  2424. c.urlParams_.Set("alt", alt)
  2425. c.urlParams_.Set("prettyPrint", "false")
  2426. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/beacons:register")
  2427. urls += "?" + c.urlParams_.Encode()
  2428. req, err := http.NewRequest("POST", urls, body)
  2429. if err != nil {
  2430. return nil, err
  2431. }
  2432. req.Header = reqHeaders
  2433. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2434. }
  2435. // Do executes the "proximitybeacon.beacons.register" call.
  2436. // Exactly one of *Beacon or error will be non-nil. Any non-2xx status
  2437. // code is an error. Response headers are in either
  2438. // *Beacon.ServerResponse.Header or (if a response was returned at all)
  2439. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2440. // check whether the returned error was because http.StatusNotModified
  2441. // was returned.
  2442. func (c *BeaconsRegisterCall) Do(opts ...googleapi.CallOption) (*Beacon, error) {
  2443. gensupport.SetOptions(c.urlParams_, opts...)
  2444. res, err := c.doRequest("json")
  2445. if res != nil && res.StatusCode == http.StatusNotModified {
  2446. if res.Body != nil {
  2447. res.Body.Close()
  2448. }
  2449. return nil, &googleapi.Error{
  2450. Code: res.StatusCode,
  2451. Header: res.Header,
  2452. }
  2453. }
  2454. if err != nil {
  2455. return nil, err
  2456. }
  2457. defer googleapi.CloseBody(res)
  2458. if err := googleapi.CheckResponse(res); err != nil {
  2459. return nil, err
  2460. }
  2461. ret := &Beacon{
  2462. ServerResponse: googleapi.ServerResponse{
  2463. Header: res.Header,
  2464. HTTPStatusCode: res.StatusCode,
  2465. },
  2466. }
  2467. target := &ret
  2468. if err := gensupport.DecodeResponse(target, res); err != nil {
  2469. return nil, err
  2470. }
  2471. return ret, nil
  2472. // {
  2473. // "description": "Registers a previously unregistered beacon given its `advertisedId`.\nThese IDs are unique within the system. An ID can be registered only once.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  2474. // "flatPath": "v1beta1/beacons:register",
  2475. // "httpMethod": "POST",
  2476. // "id": "proximitybeacon.beacons.register",
  2477. // "parameterOrder": [],
  2478. // "parameters": {
  2479. // "projectId": {
  2480. // "description": "The project id of the project the beacon will be registered to. If\nthe project id is not specified then the project making the request\nis used.\nOptional.",
  2481. // "location": "query",
  2482. // "type": "string"
  2483. // }
  2484. // },
  2485. // "path": "v1beta1/beacons:register",
  2486. // "request": {
  2487. // "$ref": "Beacon"
  2488. // },
  2489. // "response": {
  2490. // "$ref": "Beacon"
  2491. // },
  2492. // "scopes": [
  2493. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  2494. // ]
  2495. // }
  2496. }
  2497. // method id "proximitybeacon.beacons.update":
  2498. type BeaconsUpdateCall struct {
  2499. s *Service
  2500. beaconName string
  2501. beacon *Beacon
  2502. urlParams_ gensupport.URLParams
  2503. ctx_ context.Context
  2504. header_ http.Header
  2505. }
  2506. // Update: Updates the information about the specified beacon. **Any
  2507. // field that you do
  2508. // not populate in the submitted beacon will be permanently erased**, so
  2509. // you
  2510. // should follow the "read, modify, write" pattern to avoid
  2511. // inadvertently
  2512. // destroying data.
  2513. //
  2514. // Changes to the beacon status via this method will be silently
  2515. // ignored.
  2516. // To update beacon status, use the separate methods on this API
  2517. // for
  2518. // activation, deactivation, and decommissioning.
  2519. // Authenticate using an [OAuth access
  2520. // token](https://developers.google.com/identity/protocols/OAuth2)
  2521. // from a signed-in user with **Is owner** or **Can edit** permissions
  2522. // in the
  2523. // Google Developers Console project.
  2524. func (r *BeaconsService) Update(beaconName string, beacon *Beacon) *BeaconsUpdateCall {
  2525. c := &BeaconsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2526. c.beaconName = beaconName
  2527. c.beacon = beacon
  2528. return c
  2529. }
  2530. // ProjectId sets the optional parameter "projectId": The project id of
  2531. // the beacon to update. If the project id is not
  2532. // specified then the project making the request is used. The project
  2533. // id
  2534. // must match the project that owns the beacon.
  2535. func (c *BeaconsUpdateCall) ProjectId(projectId string) *BeaconsUpdateCall {
  2536. c.urlParams_.Set("projectId", projectId)
  2537. return c
  2538. }
  2539. // Fields allows partial responses to be retrieved. See
  2540. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2541. // for more information.
  2542. func (c *BeaconsUpdateCall) Fields(s ...googleapi.Field) *BeaconsUpdateCall {
  2543. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2544. return c
  2545. }
  2546. // Context sets the context to be used in this call's Do method. Any
  2547. // pending HTTP request will be aborted if the provided context is
  2548. // canceled.
  2549. func (c *BeaconsUpdateCall) Context(ctx context.Context) *BeaconsUpdateCall {
  2550. c.ctx_ = ctx
  2551. return c
  2552. }
  2553. // Header returns an http.Header that can be modified by the caller to
  2554. // add HTTP headers to the request.
  2555. func (c *BeaconsUpdateCall) Header() http.Header {
  2556. if c.header_ == nil {
  2557. c.header_ = make(http.Header)
  2558. }
  2559. return c.header_
  2560. }
  2561. func (c *BeaconsUpdateCall) doRequest(alt string) (*http.Response, error) {
  2562. reqHeaders := make(http.Header)
  2563. for k, v := range c.header_ {
  2564. reqHeaders[k] = v
  2565. }
  2566. reqHeaders.Set("User-Agent", c.s.userAgent())
  2567. var body io.Reader = nil
  2568. body, err := googleapi.WithoutDataWrapper.JSONReader(c.beacon)
  2569. if err != nil {
  2570. return nil, err
  2571. }
  2572. reqHeaders.Set("Content-Type", "application/json")
  2573. c.urlParams_.Set("alt", alt)
  2574. c.urlParams_.Set("prettyPrint", "false")
  2575. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}")
  2576. urls += "?" + c.urlParams_.Encode()
  2577. req, err := http.NewRequest("PUT", urls, body)
  2578. if err != nil {
  2579. return nil, err
  2580. }
  2581. req.Header = reqHeaders
  2582. googleapi.Expand(req.URL, map[string]string{
  2583. "beaconName": c.beaconName,
  2584. })
  2585. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2586. }
  2587. // Do executes the "proximitybeacon.beacons.update" call.
  2588. // Exactly one of *Beacon or error will be non-nil. Any non-2xx status
  2589. // code is an error. Response headers are in either
  2590. // *Beacon.ServerResponse.Header or (if a response was returned at all)
  2591. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2592. // check whether the returned error was because http.StatusNotModified
  2593. // was returned.
  2594. func (c *BeaconsUpdateCall) Do(opts ...googleapi.CallOption) (*Beacon, error) {
  2595. gensupport.SetOptions(c.urlParams_, opts...)
  2596. res, err := c.doRequest("json")
  2597. if res != nil && res.StatusCode == http.StatusNotModified {
  2598. if res.Body != nil {
  2599. res.Body.Close()
  2600. }
  2601. return nil, &googleapi.Error{
  2602. Code: res.StatusCode,
  2603. Header: res.Header,
  2604. }
  2605. }
  2606. if err != nil {
  2607. return nil, err
  2608. }
  2609. defer googleapi.CloseBody(res)
  2610. if err := googleapi.CheckResponse(res); err != nil {
  2611. return nil, err
  2612. }
  2613. ret := &Beacon{
  2614. ServerResponse: googleapi.ServerResponse{
  2615. Header: res.Header,
  2616. HTTPStatusCode: res.StatusCode,
  2617. },
  2618. }
  2619. target := &ret
  2620. if err := gensupport.DecodeResponse(target, res); err != nil {
  2621. return nil, err
  2622. }
  2623. return ret, nil
  2624. // {
  2625. // "description": "Updates the information about the specified beacon. **Any field that you do\nnot populate in the submitted beacon will be permanently erased**, so you\nshould follow the \"read, modify, write\" pattern to avoid inadvertently\ndestroying data.\n\nChanges to the beacon status via this method will be silently ignored.\nTo update beacon status, use the separate methods on this API for\nactivation, deactivation, and decommissioning.\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  2626. // "flatPath": "v1beta1/beacons/{beaconsId}",
  2627. // "httpMethod": "PUT",
  2628. // "id": "proximitybeacon.beacons.update",
  2629. // "parameterOrder": [
  2630. // "beaconName"
  2631. // ],
  2632. // "parameters": {
  2633. // "beaconName": {
  2634. // "description": "Resource name of this beacon. A beacon name has the format\n\"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast by\nthe beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone, `1` for iBeacon, or `5` for AltBeacon.\n\nThis field must be left empty when registering. After reading a beacon,\nclients can use the name for future operations.",
  2635. // "location": "path",
  2636. // "pattern": "^beacons/[^/]+$",
  2637. // "required": true,
  2638. // "type": "string"
  2639. // },
  2640. // "projectId": {
  2641. // "description": "The project id of the beacon to update. If the project id is not\nspecified then the project making the request is used. The project id\nmust match the project that owns the beacon.\nOptional.",
  2642. // "location": "query",
  2643. // "type": "string"
  2644. // }
  2645. // },
  2646. // "path": "v1beta1/{+beaconName}",
  2647. // "request": {
  2648. // "$ref": "Beacon"
  2649. // },
  2650. // "response": {
  2651. // "$ref": "Beacon"
  2652. // },
  2653. // "scopes": [
  2654. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  2655. // ]
  2656. // }
  2657. }
  2658. // method id "proximitybeacon.beacons.attachments.batchDelete":
  2659. type BeaconsAttachmentsBatchDeleteCall struct {
  2660. s *Service
  2661. beaconName string
  2662. urlParams_ gensupport.URLParams
  2663. ctx_ context.Context
  2664. header_ http.Header
  2665. }
  2666. // BatchDelete: Deletes multiple attachments on a given beacon. This
  2667. // operation is
  2668. // permanent and cannot be undone.
  2669. //
  2670. // You can optionally specify `namespacedType` to choose which
  2671. // attachments
  2672. // should be deleted. If you do not specify `namespacedType`, all
  2673. // your
  2674. // attachments on the given beacon will be deleted. You also may
  2675. // explicitly
  2676. // specify `*/*` to delete all.
  2677. //
  2678. // Authenticate using an [OAuth access
  2679. // token](https://developers.google.com/identity/protocols/OAuth2)
  2680. // from a signed-in user with **Is owner** or **Can edit** permissions
  2681. // in the
  2682. // Google Developers Console project.
  2683. func (r *BeaconsAttachmentsService) BatchDelete(beaconName string) *BeaconsAttachmentsBatchDeleteCall {
  2684. c := &BeaconsAttachmentsBatchDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2685. c.beaconName = beaconName
  2686. return c
  2687. }
  2688. // NamespacedType sets the optional parameter "namespacedType":
  2689. // Specifies the namespace and type of attachments to delete
  2690. // in
  2691. // `namespace/type` format. Accepts `*/*` to specify
  2692. // "all types in all namespaces".
  2693. func (c *BeaconsAttachmentsBatchDeleteCall) NamespacedType(namespacedType string) *BeaconsAttachmentsBatchDeleteCall {
  2694. c.urlParams_.Set("namespacedType", namespacedType)
  2695. return c
  2696. }
  2697. // ProjectId sets the optional parameter "projectId": The project id to
  2698. // delete beacon attachments under. This field can be
  2699. // used when "*" is specified to mean all attachment namespaces.
  2700. // Projects
  2701. // may have multiple attachments with multiple namespaces. If "*"
  2702. // is
  2703. // specified and the projectId string is empty, then the project
  2704. // making the request is used.
  2705. func (c *BeaconsAttachmentsBatchDeleteCall) ProjectId(projectId string) *BeaconsAttachmentsBatchDeleteCall {
  2706. c.urlParams_.Set("projectId", projectId)
  2707. return c
  2708. }
  2709. // Fields allows partial responses to be retrieved. See
  2710. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2711. // for more information.
  2712. func (c *BeaconsAttachmentsBatchDeleteCall) Fields(s ...googleapi.Field) *BeaconsAttachmentsBatchDeleteCall {
  2713. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2714. return c
  2715. }
  2716. // Context sets the context to be used in this call's Do method. Any
  2717. // pending HTTP request will be aborted if the provided context is
  2718. // canceled.
  2719. func (c *BeaconsAttachmentsBatchDeleteCall) Context(ctx context.Context) *BeaconsAttachmentsBatchDeleteCall {
  2720. c.ctx_ = ctx
  2721. return c
  2722. }
  2723. // Header returns an http.Header that can be modified by the caller to
  2724. // add HTTP headers to the request.
  2725. func (c *BeaconsAttachmentsBatchDeleteCall) Header() http.Header {
  2726. if c.header_ == nil {
  2727. c.header_ = make(http.Header)
  2728. }
  2729. return c.header_
  2730. }
  2731. func (c *BeaconsAttachmentsBatchDeleteCall) doRequest(alt string) (*http.Response, error) {
  2732. reqHeaders := make(http.Header)
  2733. for k, v := range c.header_ {
  2734. reqHeaders[k] = v
  2735. }
  2736. reqHeaders.Set("User-Agent", c.s.userAgent())
  2737. var body io.Reader = nil
  2738. c.urlParams_.Set("alt", alt)
  2739. c.urlParams_.Set("prettyPrint", "false")
  2740. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}/attachments:batchDelete")
  2741. urls += "?" + c.urlParams_.Encode()
  2742. req, err := http.NewRequest("POST", urls, body)
  2743. if err != nil {
  2744. return nil, err
  2745. }
  2746. req.Header = reqHeaders
  2747. googleapi.Expand(req.URL, map[string]string{
  2748. "beaconName": c.beaconName,
  2749. })
  2750. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2751. }
  2752. // Do executes the "proximitybeacon.beacons.attachments.batchDelete" call.
  2753. // Exactly one of *DeleteAttachmentsResponse or error will be non-nil.
  2754. // Any non-2xx status code is an error. Response headers are in either
  2755. // *DeleteAttachmentsResponse.ServerResponse.Header or (if a response
  2756. // was returned at all) in error.(*googleapi.Error).Header. Use
  2757. // googleapi.IsNotModified to check whether the returned error was
  2758. // because http.StatusNotModified was returned.
  2759. func (c *BeaconsAttachmentsBatchDeleteCall) Do(opts ...googleapi.CallOption) (*DeleteAttachmentsResponse, error) {
  2760. gensupport.SetOptions(c.urlParams_, opts...)
  2761. res, err := c.doRequest("json")
  2762. if res != nil && res.StatusCode == http.StatusNotModified {
  2763. if res.Body != nil {
  2764. res.Body.Close()
  2765. }
  2766. return nil, &googleapi.Error{
  2767. Code: res.StatusCode,
  2768. Header: res.Header,
  2769. }
  2770. }
  2771. if err != nil {
  2772. return nil, err
  2773. }
  2774. defer googleapi.CloseBody(res)
  2775. if err := googleapi.CheckResponse(res); err != nil {
  2776. return nil, err
  2777. }
  2778. ret := &DeleteAttachmentsResponse{
  2779. ServerResponse: googleapi.ServerResponse{
  2780. Header: res.Header,
  2781. HTTPStatusCode: res.StatusCode,
  2782. },
  2783. }
  2784. target := &ret
  2785. if err := gensupport.DecodeResponse(target, res); err != nil {
  2786. return nil, err
  2787. }
  2788. return ret, nil
  2789. // {
  2790. // "description": "Deletes multiple attachments on a given beacon. This operation is\npermanent and cannot be undone.\n\nYou can optionally specify `namespacedType` to choose which attachments\nshould be deleted. If you do not specify `namespacedType`, all your\nattachments on the given beacon will be deleted. You also may explicitly\nspecify `*/*` to delete all.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  2791. // "flatPath": "v1beta1/beacons/{beaconsId}/attachments:batchDelete",
  2792. // "httpMethod": "POST",
  2793. // "id": "proximitybeacon.beacons.attachments.batchDelete",
  2794. // "parameterOrder": [
  2795. // "beaconName"
  2796. // ],
  2797. // "parameters": {
  2798. // "beaconName": {
  2799. // "description": "The beacon whose attachments should be deleted. A beacon name has the\nformat \"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast\nby the beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID or the beacon's \"stable\" UID.\nRequired.",
  2800. // "location": "path",
  2801. // "pattern": "^beacons/[^/]+$",
  2802. // "required": true,
  2803. // "type": "string"
  2804. // },
  2805. // "namespacedType": {
  2806. // "description": "Specifies the namespace and type of attachments to delete in\n`namespace/type` format. Accepts `*/*` to specify\n\"all types in all namespaces\".\nOptional.",
  2807. // "location": "query",
  2808. // "type": "string"
  2809. // },
  2810. // "projectId": {
  2811. // "description": "The project id to delete beacon attachments under. This field can be\nused when \"*\" is specified to mean all attachment namespaces. Projects\nmay have multiple attachments with multiple namespaces. If \"*\" is\nspecified and the projectId string is empty, then the project\nmaking the request is used.\nOptional.",
  2812. // "location": "query",
  2813. // "type": "string"
  2814. // }
  2815. // },
  2816. // "path": "v1beta1/{+beaconName}/attachments:batchDelete",
  2817. // "response": {
  2818. // "$ref": "DeleteAttachmentsResponse"
  2819. // },
  2820. // "scopes": [
  2821. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  2822. // ]
  2823. // }
  2824. }
  2825. // method id "proximitybeacon.beacons.attachments.create":
  2826. type BeaconsAttachmentsCreateCall struct {
  2827. s *Service
  2828. beaconName string
  2829. beaconattachment *BeaconAttachment
  2830. urlParams_ gensupport.URLParams
  2831. ctx_ context.Context
  2832. header_ http.Header
  2833. }
  2834. // Create: Associates the given data with the specified beacon.
  2835. // Attachment data must
  2836. // contain two parts:
  2837. // <ul>
  2838. // <li>A namespaced type.</li>
  2839. // <li>The actual attachment data itself.</li>
  2840. // </ul>
  2841. // The namespaced type consists of two parts, the namespace and the
  2842. // type.
  2843. // The namespace must be one of the values returned by the
  2844. // `namespaces`
  2845. // endpoint, while the type can be a string of any characters except for
  2846. // the
  2847. // forward slash (`/`) up to 100 characters in length.
  2848. //
  2849. // Attachment data can be up to 1024 bytes long.
  2850. //
  2851. // Authenticate using an [OAuth access
  2852. // token](https://developers.google.com/identity/protocols/OAuth2)
  2853. // from a signed-in user with **Is owner** or **Can edit** permissions
  2854. // in the
  2855. // Google Developers Console project.
  2856. func (r *BeaconsAttachmentsService) Create(beaconName string, beaconattachment *BeaconAttachment) *BeaconsAttachmentsCreateCall {
  2857. c := &BeaconsAttachmentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2858. c.beaconName = beaconName
  2859. c.beaconattachment = beaconattachment
  2860. return c
  2861. }
  2862. // ProjectId sets the optional parameter "projectId": The project id of
  2863. // the project the attachment will belong to. If
  2864. // the project id is not specified then the project making the
  2865. // request
  2866. // is used.
  2867. func (c *BeaconsAttachmentsCreateCall) ProjectId(projectId string) *BeaconsAttachmentsCreateCall {
  2868. c.urlParams_.Set("projectId", projectId)
  2869. return c
  2870. }
  2871. // Fields allows partial responses to be retrieved. See
  2872. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2873. // for more information.
  2874. func (c *BeaconsAttachmentsCreateCall) Fields(s ...googleapi.Field) *BeaconsAttachmentsCreateCall {
  2875. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2876. return c
  2877. }
  2878. // Context sets the context to be used in this call's Do method. Any
  2879. // pending HTTP request will be aborted if the provided context is
  2880. // canceled.
  2881. func (c *BeaconsAttachmentsCreateCall) Context(ctx context.Context) *BeaconsAttachmentsCreateCall {
  2882. c.ctx_ = ctx
  2883. return c
  2884. }
  2885. // Header returns an http.Header that can be modified by the caller to
  2886. // add HTTP headers to the request.
  2887. func (c *BeaconsAttachmentsCreateCall) Header() http.Header {
  2888. if c.header_ == nil {
  2889. c.header_ = make(http.Header)
  2890. }
  2891. return c.header_
  2892. }
  2893. func (c *BeaconsAttachmentsCreateCall) doRequest(alt string) (*http.Response, error) {
  2894. reqHeaders := make(http.Header)
  2895. for k, v := range c.header_ {
  2896. reqHeaders[k] = v
  2897. }
  2898. reqHeaders.Set("User-Agent", c.s.userAgent())
  2899. var body io.Reader = nil
  2900. body, err := googleapi.WithoutDataWrapper.JSONReader(c.beaconattachment)
  2901. if err != nil {
  2902. return nil, err
  2903. }
  2904. reqHeaders.Set("Content-Type", "application/json")
  2905. c.urlParams_.Set("alt", alt)
  2906. c.urlParams_.Set("prettyPrint", "false")
  2907. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}/attachments")
  2908. urls += "?" + c.urlParams_.Encode()
  2909. req, err := http.NewRequest("POST", urls, body)
  2910. if err != nil {
  2911. return nil, err
  2912. }
  2913. req.Header = reqHeaders
  2914. googleapi.Expand(req.URL, map[string]string{
  2915. "beaconName": c.beaconName,
  2916. })
  2917. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2918. }
  2919. // Do executes the "proximitybeacon.beacons.attachments.create" call.
  2920. // Exactly one of *BeaconAttachment or error will be non-nil. Any
  2921. // non-2xx status code is an error. Response headers are in either
  2922. // *BeaconAttachment.ServerResponse.Header or (if a response was
  2923. // returned at all) in error.(*googleapi.Error).Header. Use
  2924. // googleapi.IsNotModified to check whether the returned error was
  2925. // because http.StatusNotModified was returned.
  2926. func (c *BeaconsAttachmentsCreateCall) Do(opts ...googleapi.CallOption) (*BeaconAttachment, error) {
  2927. gensupport.SetOptions(c.urlParams_, opts...)
  2928. res, err := c.doRequest("json")
  2929. if res != nil && res.StatusCode == http.StatusNotModified {
  2930. if res.Body != nil {
  2931. res.Body.Close()
  2932. }
  2933. return nil, &googleapi.Error{
  2934. Code: res.StatusCode,
  2935. Header: res.Header,
  2936. }
  2937. }
  2938. if err != nil {
  2939. return nil, err
  2940. }
  2941. defer googleapi.CloseBody(res)
  2942. if err := googleapi.CheckResponse(res); err != nil {
  2943. return nil, err
  2944. }
  2945. ret := &BeaconAttachment{
  2946. ServerResponse: googleapi.ServerResponse{
  2947. Header: res.Header,
  2948. HTTPStatusCode: res.StatusCode,
  2949. },
  2950. }
  2951. target := &ret
  2952. if err := gensupport.DecodeResponse(target, res); err != nil {
  2953. return nil, err
  2954. }
  2955. return ret, nil
  2956. // {
  2957. // "description": "Associates the given data with the specified beacon. Attachment data must\ncontain two parts:\n\u003cul\u003e\n\u003cli\u003eA namespaced type.\u003c/li\u003e\n\u003cli\u003eThe actual attachment data itself.\u003c/li\u003e\n\u003c/ul\u003e\nThe namespaced type consists of two parts, the namespace and the type.\nThe namespace must be one of the values returned by the `namespaces`\nendpoint, while the type can be a string of any characters except for the\nforward slash (`/`) up to 100 characters in length.\n\nAttachment data can be up to 1024 bytes long.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  2958. // "flatPath": "v1beta1/beacons/{beaconsId}/attachments",
  2959. // "httpMethod": "POST",
  2960. // "id": "proximitybeacon.beacons.attachments.create",
  2961. // "parameterOrder": [
  2962. // "beaconName"
  2963. // ],
  2964. // "parameters": {
  2965. // "beaconName": {
  2966. // "description": "Beacon on which the attachment should be created. A beacon name has the\nformat \"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast\nby the beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID or the beacon's \"stable\" UID.\nRequired.",
  2967. // "location": "path",
  2968. // "pattern": "^beacons/[^/]+$",
  2969. // "required": true,
  2970. // "type": "string"
  2971. // },
  2972. // "projectId": {
  2973. // "description": "The project id of the project the attachment will belong to. If\nthe project id is not specified then the project making the request\nis used.\nOptional.",
  2974. // "location": "query",
  2975. // "type": "string"
  2976. // }
  2977. // },
  2978. // "path": "v1beta1/{+beaconName}/attachments",
  2979. // "request": {
  2980. // "$ref": "BeaconAttachment"
  2981. // },
  2982. // "response": {
  2983. // "$ref": "BeaconAttachment"
  2984. // },
  2985. // "scopes": [
  2986. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  2987. // ]
  2988. // }
  2989. }
  2990. // method id "proximitybeacon.beacons.attachments.delete":
  2991. type BeaconsAttachmentsDeleteCall struct {
  2992. s *Service
  2993. attachmentName string
  2994. urlParams_ gensupport.URLParams
  2995. ctx_ context.Context
  2996. header_ http.Header
  2997. }
  2998. // Delete: Deletes the specified attachment for the given beacon. Each
  2999. // attachment has
  3000. // a unique attachment name (`attachmentName`) which is returned when
  3001. // you
  3002. // fetch the attachment data via this API. You specify this with the
  3003. // delete
  3004. // request to control which attachment is removed. This operation cannot
  3005. // be
  3006. // undone.
  3007. //
  3008. // Authenticate using an [OAuth access
  3009. // token](https://developers.google.com/identity/protocols/OAuth2)
  3010. // from a signed-in user with **Is owner** or **Can edit** permissions
  3011. // in the
  3012. // Google Developers Console project.
  3013. func (r *BeaconsAttachmentsService) Delete(attachmentName string) *BeaconsAttachmentsDeleteCall {
  3014. c := &BeaconsAttachmentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3015. c.attachmentName = attachmentName
  3016. return c
  3017. }
  3018. // ProjectId sets the optional parameter "projectId": The project id of
  3019. // the attachment to delete. If not provided, the project
  3020. // that is making the request is used.
  3021. func (c *BeaconsAttachmentsDeleteCall) ProjectId(projectId string) *BeaconsAttachmentsDeleteCall {
  3022. c.urlParams_.Set("projectId", projectId)
  3023. return c
  3024. }
  3025. // Fields allows partial responses to be retrieved. See
  3026. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3027. // for more information.
  3028. func (c *BeaconsAttachmentsDeleteCall) Fields(s ...googleapi.Field) *BeaconsAttachmentsDeleteCall {
  3029. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3030. return c
  3031. }
  3032. // Context sets the context to be used in this call's Do method. Any
  3033. // pending HTTP request will be aborted if the provided context is
  3034. // canceled.
  3035. func (c *BeaconsAttachmentsDeleteCall) Context(ctx context.Context) *BeaconsAttachmentsDeleteCall {
  3036. c.ctx_ = ctx
  3037. return c
  3038. }
  3039. // Header returns an http.Header that can be modified by the caller to
  3040. // add HTTP headers to the request.
  3041. func (c *BeaconsAttachmentsDeleteCall) Header() http.Header {
  3042. if c.header_ == nil {
  3043. c.header_ = make(http.Header)
  3044. }
  3045. return c.header_
  3046. }
  3047. func (c *BeaconsAttachmentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3048. reqHeaders := make(http.Header)
  3049. for k, v := range c.header_ {
  3050. reqHeaders[k] = v
  3051. }
  3052. reqHeaders.Set("User-Agent", c.s.userAgent())
  3053. var body io.Reader = nil
  3054. c.urlParams_.Set("alt", alt)
  3055. c.urlParams_.Set("prettyPrint", "false")
  3056. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+attachmentName}")
  3057. urls += "?" + c.urlParams_.Encode()
  3058. req, err := http.NewRequest("DELETE", urls, body)
  3059. if err != nil {
  3060. return nil, err
  3061. }
  3062. req.Header = reqHeaders
  3063. googleapi.Expand(req.URL, map[string]string{
  3064. "attachmentName": c.attachmentName,
  3065. })
  3066. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3067. }
  3068. // Do executes the "proximitybeacon.beacons.attachments.delete" call.
  3069. // Exactly one of *Empty or error will be non-nil. Any non-2xx status
  3070. // code is an error. Response headers are in either
  3071. // *Empty.ServerResponse.Header or (if a response was returned at all)
  3072. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3073. // check whether the returned error was because http.StatusNotModified
  3074. // was returned.
  3075. func (c *BeaconsAttachmentsDeleteCall) Do(opts ...googleapi.CallOption) (*Empty, error) {
  3076. gensupport.SetOptions(c.urlParams_, opts...)
  3077. res, err := c.doRequest("json")
  3078. if res != nil && res.StatusCode == http.StatusNotModified {
  3079. if res.Body != nil {
  3080. res.Body.Close()
  3081. }
  3082. return nil, &googleapi.Error{
  3083. Code: res.StatusCode,
  3084. Header: res.Header,
  3085. }
  3086. }
  3087. if err != nil {
  3088. return nil, err
  3089. }
  3090. defer googleapi.CloseBody(res)
  3091. if err := googleapi.CheckResponse(res); err != nil {
  3092. return nil, err
  3093. }
  3094. ret := &Empty{
  3095. ServerResponse: googleapi.ServerResponse{
  3096. Header: res.Header,
  3097. HTTPStatusCode: res.StatusCode,
  3098. },
  3099. }
  3100. target := &ret
  3101. if err := gensupport.DecodeResponse(target, res); err != nil {
  3102. return nil, err
  3103. }
  3104. return ret, nil
  3105. // {
  3106. // "description": "Deletes the specified attachment for the given beacon. Each attachment has\na unique attachment name (`attachmentName`) which is returned when you\nfetch the attachment data via this API. You specify this with the delete\nrequest to control which attachment is removed. This operation cannot be\nundone.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **Is owner** or **Can edit** permissions in the\nGoogle Developers Console project.",
  3107. // "flatPath": "v1beta1/beacons/{beaconsId}/attachments/{attachmentsId}",
  3108. // "httpMethod": "DELETE",
  3109. // "id": "proximitybeacon.beacons.attachments.delete",
  3110. // "parameterOrder": [
  3111. // "attachmentName"
  3112. // ],
  3113. // "parameters": {
  3114. // "attachmentName": {
  3115. // "description": "The attachment name (`attachmentName`) of\nthe attachment to remove. For example:\n`beacons/3!893737abc9/attachments/c5e937-af0-494-959-ec49d12738`. For\nEddystone-EID beacons, the beacon ID portion (`3!893737abc9`) may be the\nbeacon's current EID, or its \"stable\" Eddystone-UID.\nRequired.",
  3116. // "location": "path",
  3117. // "pattern": "^beacons/[^/]+/attachments/[^/]+$",
  3118. // "required": true,
  3119. // "type": "string"
  3120. // },
  3121. // "projectId": {
  3122. // "description": "The project id of the attachment to delete. If not provided, the project\nthat is making the request is used.\nOptional.",
  3123. // "location": "query",
  3124. // "type": "string"
  3125. // }
  3126. // },
  3127. // "path": "v1beta1/{+attachmentName}",
  3128. // "response": {
  3129. // "$ref": "Empty"
  3130. // },
  3131. // "scopes": [
  3132. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  3133. // ]
  3134. // }
  3135. }
  3136. // method id "proximitybeacon.beacons.attachments.list":
  3137. type BeaconsAttachmentsListCall struct {
  3138. s *Service
  3139. beaconName string
  3140. urlParams_ gensupport.URLParams
  3141. ifNoneMatch_ string
  3142. ctx_ context.Context
  3143. header_ http.Header
  3144. }
  3145. // List: Returns the attachments for the specified beacon that match the
  3146. // specified
  3147. // namespaced-type pattern.
  3148. //
  3149. // To control which namespaced types are returned, you add
  3150. // the
  3151. // `namespacedType` query parameter to the request. You must either
  3152. // use
  3153. // `*/*`, to return all attachments, or the namespace must be one of
  3154. // the ones returned from the `namespaces` endpoint.
  3155. //
  3156. // Authenticate using an [OAuth access
  3157. // token](https://developers.google.com/identity/protocols/OAuth2)
  3158. // from a signed-in user with **viewer**, **Is owner** or **Can
  3159. // edit**
  3160. // permissions in the Google Developers Console project.
  3161. func (r *BeaconsAttachmentsService) List(beaconName string) *BeaconsAttachmentsListCall {
  3162. c := &BeaconsAttachmentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3163. c.beaconName = beaconName
  3164. return c
  3165. }
  3166. // NamespacedType sets the optional parameter "namespacedType":
  3167. // Specifies the namespace and type of attachment to include in response
  3168. // in
  3169. // <var>namespace/type</var> format. Accepts `*/*` to specify
  3170. // "all types in all namespaces".
  3171. func (c *BeaconsAttachmentsListCall) NamespacedType(namespacedType string) *BeaconsAttachmentsListCall {
  3172. c.urlParams_.Set("namespacedType", namespacedType)
  3173. return c
  3174. }
  3175. // ProjectId sets the optional parameter "projectId": The project id to
  3176. // list beacon attachments under. This field can be
  3177. // used when "*" is specified to mean all attachment namespaces.
  3178. // Projects
  3179. // may have multiple attachments with multiple namespaces. If "*"
  3180. // is
  3181. // specified and the projectId string is empty, then the project
  3182. // making the request is used.
  3183. func (c *BeaconsAttachmentsListCall) ProjectId(projectId string) *BeaconsAttachmentsListCall {
  3184. c.urlParams_.Set("projectId", projectId)
  3185. return c
  3186. }
  3187. // Fields allows partial responses to be retrieved. See
  3188. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3189. // for more information.
  3190. func (c *BeaconsAttachmentsListCall) Fields(s ...googleapi.Field) *BeaconsAttachmentsListCall {
  3191. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3192. return c
  3193. }
  3194. // IfNoneMatch sets the optional parameter which makes the operation
  3195. // fail if the object's ETag matches the given value. This is useful for
  3196. // getting updates only after the object has changed since the last
  3197. // request. Use googleapi.IsNotModified to check whether the response
  3198. // error from Do is the result of In-None-Match.
  3199. func (c *BeaconsAttachmentsListCall) IfNoneMatch(entityTag string) *BeaconsAttachmentsListCall {
  3200. c.ifNoneMatch_ = entityTag
  3201. return c
  3202. }
  3203. // Context sets the context to be used in this call's Do method. Any
  3204. // pending HTTP request will be aborted if the provided context is
  3205. // canceled.
  3206. func (c *BeaconsAttachmentsListCall) Context(ctx context.Context) *BeaconsAttachmentsListCall {
  3207. c.ctx_ = ctx
  3208. return c
  3209. }
  3210. // Header returns an http.Header that can be modified by the caller to
  3211. // add HTTP headers to the request.
  3212. func (c *BeaconsAttachmentsListCall) Header() http.Header {
  3213. if c.header_ == nil {
  3214. c.header_ = make(http.Header)
  3215. }
  3216. return c.header_
  3217. }
  3218. func (c *BeaconsAttachmentsListCall) doRequest(alt string) (*http.Response, error) {
  3219. reqHeaders := make(http.Header)
  3220. for k, v := range c.header_ {
  3221. reqHeaders[k] = v
  3222. }
  3223. reqHeaders.Set("User-Agent", c.s.userAgent())
  3224. if c.ifNoneMatch_ != "" {
  3225. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3226. }
  3227. var body io.Reader = nil
  3228. c.urlParams_.Set("alt", alt)
  3229. c.urlParams_.Set("prettyPrint", "false")
  3230. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}/attachments")
  3231. urls += "?" + c.urlParams_.Encode()
  3232. req, err := http.NewRequest("GET", urls, body)
  3233. if err != nil {
  3234. return nil, err
  3235. }
  3236. req.Header = reqHeaders
  3237. googleapi.Expand(req.URL, map[string]string{
  3238. "beaconName": c.beaconName,
  3239. })
  3240. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3241. }
  3242. // Do executes the "proximitybeacon.beacons.attachments.list" call.
  3243. // Exactly one of *ListBeaconAttachmentsResponse or error will be
  3244. // non-nil. Any non-2xx status code is an error. Response headers are in
  3245. // either *ListBeaconAttachmentsResponse.ServerResponse.Header or (if a
  3246. // response was returned at all) in error.(*googleapi.Error).Header. Use
  3247. // googleapi.IsNotModified to check whether the returned error was
  3248. // because http.StatusNotModified was returned.
  3249. func (c *BeaconsAttachmentsListCall) Do(opts ...googleapi.CallOption) (*ListBeaconAttachmentsResponse, error) {
  3250. gensupport.SetOptions(c.urlParams_, opts...)
  3251. res, err := c.doRequest("json")
  3252. if res != nil && res.StatusCode == http.StatusNotModified {
  3253. if res.Body != nil {
  3254. res.Body.Close()
  3255. }
  3256. return nil, &googleapi.Error{
  3257. Code: res.StatusCode,
  3258. Header: res.Header,
  3259. }
  3260. }
  3261. if err != nil {
  3262. return nil, err
  3263. }
  3264. defer googleapi.CloseBody(res)
  3265. if err := googleapi.CheckResponse(res); err != nil {
  3266. return nil, err
  3267. }
  3268. ret := &ListBeaconAttachmentsResponse{
  3269. ServerResponse: googleapi.ServerResponse{
  3270. Header: res.Header,
  3271. HTTPStatusCode: res.StatusCode,
  3272. },
  3273. }
  3274. target := &ret
  3275. if err := gensupport.DecodeResponse(target, res); err != nil {
  3276. return nil, err
  3277. }
  3278. return ret, nil
  3279. // {
  3280. // "description": "Returns the attachments for the specified beacon that match the specified\nnamespaced-type pattern.\n\nTo control which namespaced types are returned, you add the\n`namespacedType` query parameter to the request. You must either use\n`*/*`, to return all attachments, or the namespace must be one of\nthe ones returned from the `namespaces` endpoint.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **viewer**, **Is owner** or **Can edit**\npermissions in the Google Developers Console project.",
  3281. // "flatPath": "v1beta1/beacons/{beaconsId}/attachments",
  3282. // "httpMethod": "GET",
  3283. // "id": "proximitybeacon.beacons.attachments.list",
  3284. // "parameterOrder": [
  3285. // "beaconName"
  3286. // ],
  3287. // "parameters": {
  3288. // "beaconName": {
  3289. // "description": "Beacon whose attachments should be fetched. A beacon name has the\nformat \"beacons/N!beaconId\" where the beaconId is the base16 ID broadcast\nby the beacon and N is a code for the beacon's type. Possible values are\n`3` for Eddystone-UID, `4` for Eddystone-EID, `1` for iBeacon, or `5`\nfor AltBeacon. For Eddystone-EID beacons, you may use either the\ncurrent EID or the beacon's \"stable\" UID.\nRequired.",
  3290. // "location": "path",
  3291. // "pattern": "^beacons/[^/]+$",
  3292. // "required": true,
  3293. // "type": "string"
  3294. // },
  3295. // "namespacedType": {
  3296. // "description": "Specifies the namespace and type of attachment to include in response in\n\u003cvar\u003enamespace/type\u003c/var\u003e format. Accepts `*/*` to specify\n\"all types in all namespaces\".",
  3297. // "location": "query",
  3298. // "type": "string"
  3299. // },
  3300. // "projectId": {
  3301. // "description": "The project id to list beacon attachments under. This field can be\nused when \"*\" is specified to mean all attachment namespaces. Projects\nmay have multiple attachments with multiple namespaces. If \"*\" is\nspecified and the projectId string is empty, then the project\nmaking the request is used.\nOptional.",
  3302. // "location": "query",
  3303. // "type": "string"
  3304. // }
  3305. // },
  3306. // "path": "v1beta1/{+beaconName}/attachments",
  3307. // "response": {
  3308. // "$ref": "ListBeaconAttachmentsResponse"
  3309. // },
  3310. // "scopes": [
  3311. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  3312. // ]
  3313. // }
  3314. }
  3315. // method id "proximitybeacon.beacons.diagnostics.list":
  3316. type BeaconsDiagnosticsListCall struct {
  3317. s *Service
  3318. beaconName string
  3319. urlParams_ gensupport.URLParams
  3320. ifNoneMatch_ string
  3321. ctx_ context.Context
  3322. header_ http.Header
  3323. }
  3324. // List: List the diagnostics for a single beacon. You can also list
  3325. // diagnostics for
  3326. // all the beacons owned by your Google Developers Console project by
  3327. // using
  3328. // the beacon name `beacons/-`.
  3329. //
  3330. // Authenticate using an [OAuth access
  3331. // token](https://developers.google.com/identity/protocols/OAuth2)
  3332. // from a signed-in user with **viewer**, **Is owner** or **Can
  3333. // edit**
  3334. // permissions in the Google Developers Console project.
  3335. func (r *BeaconsDiagnosticsService) List(beaconName string) *BeaconsDiagnosticsListCall {
  3336. c := &BeaconsDiagnosticsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3337. c.beaconName = beaconName
  3338. return c
  3339. }
  3340. // AlertFilter sets the optional parameter "alertFilter": Requests only
  3341. // beacons that have the given alert. For example, to find
  3342. // beacons that have low batteries use `alert_filter=LOW_BATTERY`.
  3343. //
  3344. // Possible values:
  3345. // "ALERT_UNSPECIFIED"
  3346. // "WRONG_LOCATION"
  3347. // "LOW_BATTERY"
  3348. // "LOW_ACTIVITY"
  3349. func (c *BeaconsDiagnosticsListCall) AlertFilter(alertFilter string) *BeaconsDiagnosticsListCall {
  3350. c.urlParams_.Set("alertFilter", alertFilter)
  3351. return c
  3352. }
  3353. // PageSize sets the optional parameter "pageSize": Specifies the
  3354. // maximum number of results to return. Defaults to
  3355. // 10. Maximum 1000.
  3356. func (c *BeaconsDiagnosticsListCall) PageSize(pageSize int64) *BeaconsDiagnosticsListCall {
  3357. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3358. return c
  3359. }
  3360. // PageToken sets the optional parameter "pageToken": Requests results
  3361. // that occur after the `page_token`, obtained from the
  3362. // response to a previous request.
  3363. func (c *BeaconsDiagnosticsListCall) PageToken(pageToken string) *BeaconsDiagnosticsListCall {
  3364. c.urlParams_.Set("pageToken", pageToken)
  3365. return c
  3366. }
  3367. // ProjectId sets the optional parameter "projectId": Requests only
  3368. // diagnostic records for the given project id. If not set,
  3369. // then the project making the request will be used for looking
  3370. // up
  3371. // diagnostic records.
  3372. func (c *BeaconsDiagnosticsListCall) ProjectId(projectId string) *BeaconsDiagnosticsListCall {
  3373. c.urlParams_.Set("projectId", projectId)
  3374. return c
  3375. }
  3376. // Fields allows partial responses to be retrieved. See
  3377. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3378. // for more information.
  3379. func (c *BeaconsDiagnosticsListCall) Fields(s ...googleapi.Field) *BeaconsDiagnosticsListCall {
  3380. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3381. return c
  3382. }
  3383. // IfNoneMatch sets the optional parameter which makes the operation
  3384. // fail if the object's ETag matches the given value. This is useful for
  3385. // getting updates only after the object has changed since the last
  3386. // request. Use googleapi.IsNotModified to check whether the response
  3387. // error from Do is the result of In-None-Match.
  3388. func (c *BeaconsDiagnosticsListCall) IfNoneMatch(entityTag string) *BeaconsDiagnosticsListCall {
  3389. c.ifNoneMatch_ = entityTag
  3390. return c
  3391. }
  3392. // Context sets the context to be used in this call's Do method. Any
  3393. // pending HTTP request will be aborted if the provided context is
  3394. // canceled.
  3395. func (c *BeaconsDiagnosticsListCall) Context(ctx context.Context) *BeaconsDiagnosticsListCall {
  3396. c.ctx_ = ctx
  3397. return c
  3398. }
  3399. // Header returns an http.Header that can be modified by the caller to
  3400. // add HTTP headers to the request.
  3401. func (c *BeaconsDiagnosticsListCall) Header() http.Header {
  3402. if c.header_ == nil {
  3403. c.header_ = make(http.Header)
  3404. }
  3405. return c.header_
  3406. }
  3407. func (c *BeaconsDiagnosticsListCall) doRequest(alt string) (*http.Response, error) {
  3408. reqHeaders := make(http.Header)
  3409. for k, v := range c.header_ {
  3410. reqHeaders[k] = v
  3411. }
  3412. reqHeaders.Set("User-Agent", c.s.userAgent())
  3413. if c.ifNoneMatch_ != "" {
  3414. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3415. }
  3416. var body io.Reader = nil
  3417. c.urlParams_.Set("alt", alt)
  3418. c.urlParams_.Set("prettyPrint", "false")
  3419. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+beaconName}/diagnostics")
  3420. urls += "?" + c.urlParams_.Encode()
  3421. req, err := http.NewRequest("GET", urls, body)
  3422. if err != nil {
  3423. return nil, err
  3424. }
  3425. req.Header = reqHeaders
  3426. googleapi.Expand(req.URL, map[string]string{
  3427. "beaconName": c.beaconName,
  3428. })
  3429. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3430. }
  3431. // Do executes the "proximitybeacon.beacons.diagnostics.list" call.
  3432. // Exactly one of *ListDiagnosticsResponse or error will be non-nil. Any
  3433. // non-2xx status code is an error. Response headers are in either
  3434. // *ListDiagnosticsResponse.ServerResponse.Header or (if a response was
  3435. // returned at all) in error.(*googleapi.Error).Header. Use
  3436. // googleapi.IsNotModified to check whether the returned error was
  3437. // because http.StatusNotModified was returned.
  3438. func (c *BeaconsDiagnosticsListCall) Do(opts ...googleapi.CallOption) (*ListDiagnosticsResponse, error) {
  3439. gensupport.SetOptions(c.urlParams_, opts...)
  3440. res, err := c.doRequest("json")
  3441. if res != nil && res.StatusCode == http.StatusNotModified {
  3442. if res.Body != nil {
  3443. res.Body.Close()
  3444. }
  3445. return nil, &googleapi.Error{
  3446. Code: res.StatusCode,
  3447. Header: res.Header,
  3448. }
  3449. }
  3450. if err != nil {
  3451. return nil, err
  3452. }
  3453. defer googleapi.CloseBody(res)
  3454. if err := googleapi.CheckResponse(res); err != nil {
  3455. return nil, err
  3456. }
  3457. ret := &ListDiagnosticsResponse{
  3458. ServerResponse: googleapi.ServerResponse{
  3459. Header: res.Header,
  3460. HTTPStatusCode: res.StatusCode,
  3461. },
  3462. }
  3463. target := &ret
  3464. if err := gensupport.DecodeResponse(target, res); err != nil {
  3465. return nil, err
  3466. }
  3467. return ret, nil
  3468. // {
  3469. // "description": "List the diagnostics for a single beacon. You can also list diagnostics for\nall the beacons owned by your Google Developers Console project by using\nthe beacon name `beacons/-`.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **viewer**, **Is owner** or **Can edit**\npermissions in the Google Developers Console project.",
  3470. // "flatPath": "v1beta1/beacons/{beaconsId}/diagnostics",
  3471. // "httpMethod": "GET",
  3472. // "id": "proximitybeacon.beacons.diagnostics.list",
  3473. // "parameterOrder": [
  3474. // "beaconName"
  3475. // ],
  3476. // "parameters": {
  3477. // "alertFilter": {
  3478. // "description": "Requests only beacons that have the given alert. For example, to find\nbeacons that have low batteries use `alert_filter=LOW_BATTERY`.",
  3479. // "enum": [
  3480. // "ALERT_UNSPECIFIED",
  3481. // "WRONG_LOCATION",
  3482. // "LOW_BATTERY",
  3483. // "LOW_ACTIVITY"
  3484. // ],
  3485. // "location": "query",
  3486. // "type": "string"
  3487. // },
  3488. // "beaconName": {
  3489. // "description": "Beacon that the diagnostics are for.",
  3490. // "location": "path",
  3491. // "pattern": "^beacons/[^/]+$",
  3492. // "required": true,
  3493. // "type": "string"
  3494. // },
  3495. // "pageSize": {
  3496. // "description": "Specifies the maximum number of results to return. Defaults to\n10. Maximum 1000. Optional.",
  3497. // "format": "int32",
  3498. // "location": "query",
  3499. // "type": "integer"
  3500. // },
  3501. // "pageToken": {
  3502. // "description": "Requests results that occur after the `page_token`, obtained from the\nresponse to a previous request. Optional.",
  3503. // "location": "query",
  3504. // "type": "string"
  3505. // },
  3506. // "projectId": {
  3507. // "description": "Requests only diagnostic records for the given project id. If not set,\nthen the project making the request will be used for looking up\ndiagnostic records. Optional.",
  3508. // "location": "query",
  3509. // "type": "string"
  3510. // }
  3511. // },
  3512. // "path": "v1beta1/{+beaconName}/diagnostics",
  3513. // "response": {
  3514. // "$ref": "ListDiagnosticsResponse"
  3515. // },
  3516. // "scopes": [
  3517. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  3518. // ]
  3519. // }
  3520. }
  3521. // Pages invokes f for each page of results.
  3522. // A non-nil error returned from f will halt the iteration.
  3523. // The provided context supersedes any context provided to the Context method.
  3524. func (c *BeaconsDiagnosticsListCall) Pages(ctx context.Context, f func(*ListDiagnosticsResponse) error) error {
  3525. c.ctx_ = ctx
  3526. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3527. for {
  3528. x, err := c.Do()
  3529. if err != nil {
  3530. return err
  3531. }
  3532. if err := f(x); err != nil {
  3533. return err
  3534. }
  3535. if x.NextPageToken == "" {
  3536. return nil
  3537. }
  3538. c.PageToken(x.NextPageToken)
  3539. }
  3540. }
  3541. // method id "proximitybeacon.namespaces.list":
  3542. type NamespacesListCall struct {
  3543. s *Service
  3544. urlParams_ gensupport.URLParams
  3545. ifNoneMatch_ string
  3546. ctx_ context.Context
  3547. header_ http.Header
  3548. }
  3549. // List: Lists all attachment namespaces owned by your Google Developers
  3550. // Console
  3551. // project. Attachment data associated with a beacon must include
  3552. // a
  3553. // namespaced type, and the namespace must be owned by your
  3554. // project.
  3555. //
  3556. // Authenticate using an [OAuth access
  3557. // token](https://developers.google.com/identity/protocols/OAuth2)
  3558. // from a signed-in user with **viewer**, **Is owner** or **Can
  3559. // edit**
  3560. // permissions in the Google Developers Console project.
  3561. func (r *NamespacesService) List() *NamespacesListCall {
  3562. c := &NamespacesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3563. return c
  3564. }
  3565. // ProjectId sets the optional parameter "projectId": The project id to
  3566. // list namespaces under.
  3567. func (c *NamespacesListCall) ProjectId(projectId string) *NamespacesListCall {
  3568. c.urlParams_.Set("projectId", projectId)
  3569. return c
  3570. }
  3571. // Fields allows partial responses to be retrieved. See
  3572. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3573. // for more information.
  3574. func (c *NamespacesListCall) Fields(s ...googleapi.Field) *NamespacesListCall {
  3575. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3576. return c
  3577. }
  3578. // IfNoneMatch sets the optional parameter which makes the operation
  3579. // fail if the object's ETag matches the given value. This is useful for
  3580. // getting updates only after the object has changed since the last
  3581. // request. Use googleapi.IsNotModified to check whether the response
  3582. // error from Do is the result of In-None-Match.
  3583. func (c *NamespacesListCall) IfNoneMatch(entityTag string) *NamespacesListCall {
  3584. c.ifNoneMatch_ = entityTag
  3585. return c
  3586. }
  3587. // Context sets the context to be used in this call's Do method. Any
  3588. // pending HTTP request will be aborted if the provided context is
  3589. // canceled.
  3590. func (c *NamespacesListCall) Context(ctx context.Context) *NamespacesListCall {
  3591. c.ctx_ = ctx
  3592. return c
  3593. }
  3594. // Header returns an http.Header that can be modified by the caller to
  3595. // add HTTP headers to the request.
  3596. func (c *NamespacesListCall) Header() http.Header {
  3597. if c.header_ == nil {
  3598. c.header_ = make(http.Header)
  3599. }
  3600. return c.header_
  3601. }
  3602. func (c *NamespacesListCall) doRequest(alt string) (*http.Response, error) {
  3603. reqHeaders := make(http.Header)
  3604. for k, v := range c.header_ {
  3605. reqHeaders[k] = v
  3606. }
  3607. reqHeaders.Set("User-Agent", c.s.userAgent())
  3608. if c.ifNoneMatch_ != "" {
  3609. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3610. }
  3611. var body io.Reader = nil
  3612. c.urlParams_.Set("alt", alt)
  3613. c.urlParams_.Set("prettyPrint", "false")
  3614. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/namespaces")
  3615. urls += "?" + c.urlParams_.Encode()
  3616. req, err := http.NewRequest("GET", urls, body)
  3617. if err != nil {
  3618. return nil, err
  3619. }
  3620. req.Header = reqHeaders
  3621. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3622. }
  3623. // Do executes the "proximitybeacon.namespaces.list" call.
  3624. // Exactly one of *ListNamespacesResponse or error will be non-nil. Any
  3625. // non-2xx status code is an error. Response headers are in either
  3626. // *ListNamespacesResponse.ServerResponse.Header or (if a response was
  3627. // returned at all) in error.(*googleapi.Error).Header. Use
  3628. // googleapi.IsNotModified to check whether the returned error was
  3629. // because http.StatusNotModified was returned.
  3630. func (c *NamespacesListCall) Do(opts ...googleapi.CallOption) (*ListNamespacesResponse, error) {
  3631. gensupport.SetOptions(c.urlParams_, opts...)
  3632. res, err := c.doRequest("json")
  3633. if res != nil && res.StatusCode == http.StatusNotModified {
  3634. if res.Body != nil {
  3635. res.Body.Close()
  3636. }
  3637. return nil, &googleapi.Error{
  3638. Code: res.StatusCode,
  3639. Header: res.Header,
  3640. }
  3641. }
  3642. if err != nil {
  3643. return nil, err
  3644. }
  3645. defer googleapi.CloseBody(res)
  3646. if err := googleapi.CheckResponse(res); err != nil {
  3647. return nil, err
  3648. }
  3649. ret := &ListNamespacesResponse{
  3650. ServerResponse: googleapi.ServerResponse{
  3651. Header: res.Header,
  3652. HTTPStatusCode: res.StatusCode,
  3653. },
  3654. }
  3655. target := &ret
  3656. if err := gensupport.DecodeResponse(target, res); err != nil {
  3657. return nil, err
  3658. }
  3659. return ret, nil
  3660. // {
  3661. // "description": "Lists all attachment namespaces owned by your Google Developers Console\nproject. Attachment data associated with a beacon must include a\nnamespaced type, and the namespace must be owned by your project.\n\nAuthenticate using an [OAuth access token](https://developers.google.com/identity/protocols/OAuth2)\nfrom a signed-in user with **viewer**, **Is owner** or **Can edit**\npermissions in the Google Developers Console project.",
  3662. // "flatPath": "v1beta1/namespaces",
  3663. // "httpMethod": "GET",
  3664. // "id": "proximitybeacon.namespaces.list",
  3665. // "parameterOrder": [],
  3666. // "parameters": {
  3667. // "projectId": {
  3668. // "description": "The project id to list namespaces under.\nOptional.",
  3669. // "location": "query",
  3670. // "type": "string"
  3671. // }
  3672. // },
  3673. // "path": "v1beta1/namespaces",
  3674. // "response": {
  3675. // "$ref": "ListNamespacesResponse"
  3676. // },
  3677. // "scopes": [
  3678. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  3679. // ]
  3680. // }
  3681. }
  3682. // method id "proximitybeacon.namespaces.update":
  3683. type NamespacesUpdateCall struct {
  3684. s *Service
  3685. namespaceName string
  3686. namespace *Namespace
  3687. urlParams_ gensupport.URLParams
  3688. ctx_ context.Context
  3689. header_ http.Header
  3690. }
  3691. // Update: Updates the information about the specified namespace. Only
  3692. // the namespace
  3693. // visibility can be updated.
  3694. func (r *NamespacesService) Update(namespaceName string, namespace *Namespace) *NamespacesUpdateCall {
  3695. c := &NamespacesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3696. c.namespaceName = namespaceName
  3697. c.namespace = namespace
  3698. return c
  3699. }
  3700. // ProjectId sets the optional parameter "projectId": The project id of
  3701. // the namespace to update. If the project id is not
  3702. // specified then the project making the request is used. The project
  3703. // id
  3704. // must match the project that owns the beacon.
  3705. func (c *NamespacesUpdateCall) ProjectId(projectId string) *NamespacesUpdateCall {
  3706. c.urlParams_.Set("projectId", projectId)
  3707. return c
  3708. }
  3709. // Fields allows partial responses to be retrieved. See
  3710. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3711. // for more information.
  3712. func (c *NamespacesUpdateCall) Fields(s ...googleapi.Field) *NamespacesUpdateCall {
  3713. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3714. return c
  3715. }
  3716. // Context sets the context to be used in this call's Do method. Any
  3717. // pending HTTP request will be aborted if the provided context is
  3718. // canceled.
  3719. func (c *NamespacesUpdateCall) Context(ctx context.Context) *NamespacesUpdateCall {
  3720. c.ctx_ = ctx
  3721. return c
  3722. }
  3723. // Header returns an http.Header that can be modified by the caller to
  3724. // add HTTP headers to the request.
  3725. func (c *NamespacesUpdateCall) Header() http.Header {
  3726. if c.header_ == nil {
  3727. c.header_ = make(http.Header)
  3728. }
  3729. return c.header_
  3730. }
  3731. func (c *NamespacesUpdateCall) doRequest(alt string) (*http.Response, error) {
  3732. reqHeaders := make(http.Header)
  3733. for k, v := range c.header_ {
  3734. reqHeaders[k] = v
  3735. }
  3736. reqHeaders.Set("User-Agent", c.s.userAgent())
  3737. var body io.Reader = nil
  3738. body, err := googleapi.WithoutDataWrapper.JSONReader(c.namespace)
  3739. if err != nil {
  3740. return nil, err
  3741. }
  3742. reqHeaders.Set("Content-Type", "application/json")
  3743. c.urlParams_.Set("alt", alt)
  3744. c.urlParams_.Set("prettyPrint", "false")
  3745. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/{+namespaceName}")
  3746. urls += "?" + c.urlParams_.Encode()
  3747. req, err := http.NewRequest("PUT", urls, body)
  3748. if err != nil {
  3749. return nil, err
  3750. }
  3751. req.Header = reqHeaders
  3752. googleapi.Expand(req.URL, map[string]string{
  3753. "namespaceName": c.namespaceName,
  3754. })
  3755. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3756. }
  3757. // Do executes the "proximitybeacon.namespaces.update" call.
  3758. // Exactly one of *Namespace or error will be non-nil. Any non-2xx
  3759. // status code is an error. Response headers are in either
  3760. // *Namespace.ServerResponse.Header or (if a response was returned at
  3761. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3762. // to check whether the returned error was because
  3763. // http.StatusNotModified was returned.
  3764. func (c *NamespacesUpdateCall) Do(opts ...googleapi.CallOption) (*Namespace, error) {
  3765. gensupport.SetOptions(c.urlParams_, opts...)
  3766. res, err := c.doRequest("json")
  3767. if res != nil && res.StatusCode == http.StatusNotModified {
  3768. if res.Body != nil {
  3769. res.Body.Close()
  3770. }
  3771. return nil, &googleapi.Error{
  3772. Code: res.StatusCode,
  3773. Header: res.Header,
  3774. }
  3775. }
  3776. if err != nil {
  3777. return nil, err
  3778. }
  3779. defer googleapi.CloseBody(res)
  3780. if err := googleapi.CheckResponse(res); err != nil {
  3781. return nil, err
  3782. }
  3783. ret := &Namespace{
  3784. ServerResponse: googleapi.ServerResponse{
  3785. Header: res.Header,
  3786. HTTPStatusCode: res.StatusCode,
  3787. },
  3788. }
  3789. target := &ret
  3790. if err := gensupport.DecodeResponse(target, res); err != nil {
  3791. return nil, err
  3792. }
  3793. return ret, nil
  3794. // {
  3795. // "description": "Updates the information about the specified namespace. Only the namespace\nvisibility can be updated.",
  3796. // "flatPath": "v1beta1/namespaces/{namespacesId}",
  3797. // "httpMethod": "PUT",
  3798. // "id": "proximitybeacon.namespaces.update",
  3799. // "parameterOrder": [
  3800. // "namespaceName"
  3801. // ],
  3802. // "parameters": {
  3803. // "namespaceName": {
  3804. // "description": "Resource name of this namespace. Namespaces names have the format:\n\u003ccode\u003enamespaces/\u003cvar\u003enamespace\u003c/var\u003e\u003c/code\u003e.",
  3805. // "location": "path",
  3806. // "pattern": "^namespaces/[^/]+$",
  3807. // "required": true,
  3808. // "type": "string"
  3809. // },
  3810. // "projectId": {
  3811. // "description": "The project id of the namespace to update. If the project id is not\nspecified then the project making the request is used. The project id\nmust match the project that owns the beacon.\nOptional.",
  3812. // "location": "query",
  3813. // "type": "string"
  3814. // }
  3815. // },
  3816. // "path": "v1beta1/{+namespaceName}",
  3817. // "request": {
  3818. // "$ref": "Namespace"
  3819. // },
  3820. // "response": {
  3821. // "$ref": "Namespace"
  3822. // },
  3823. // "scopes": [
  3824. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  3825. // ]
  3826. // }
  3827. }
  3828. // method id "proximitybeacon.getEidparams":
  3829. type V1beta1GetEidparamsCall struct {
  3830. s *Service
  3831. urlParams_ gensupport.URLParams
  3832. ifNoneMatch_ string
  3833. ctx_ context.Context
  3834. header_ http.Header
  3835. }
  3836. // GetEidparams: Gets the Proximity Beacon API's current public key and
  3837. // associated
  3838. // parameters used to initiate the Diffie-Hellman key exchange required
  3839. // to
  3840. // register a beacon that broadcasts the Eddystone-EID format. This
  3841. // key
  3842. // changes periodically; clients may cache it and re-use the same public
  3843. // key
  3844. // to provision and register multiple beacons. However, clients should
  3845. // be
  3846. // prepared to refresh this key when they encounter an error registering
  3847. // an
  3848. // Eddystone-EID beacon.
  3849. func (r *V1beta1Service) GetEidparams() *V1beta1GetEidparamsCall {
  3850. c := &V1beta1GetEidparamsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3851. return c
  3852. }
  3853. // Fields allows partial responses to be retrieved. See
  3854. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3855. // for more information.
  3856. func (c *V1beta1GetEidparamsCall) Fields(s ...googleapi.Field) *V1beta1GetEidparamsCall {
  3857. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3858. return c
  3859. }
  3860. // IfNoneMatch sets the optional parameter which makes the operation
  3861. // fail if the object's ETag matches the given value. This is useful for
  3862. // getting updates only after the object has changed since the last
  3863. // request. Use googleapi.IsNotModified to check whether the response
  3864. // error from Do is the result of In-None-Match.
  3865. func (c *V1beta1GetEidparamsCall) IfNoneMatch(entityTag string) *V1beta1GetEidparamsCall {
  3866. c.ifNoneMatch_ = entityTag
  3867. return c
  3868. }
  3869. // Context sets the context to be used in this call's Do method. Any
  3870. // pending HTTP request will be aborted if the provided context is
  3871. // canceled.
  3872. func (c *V1beta1GetEidparamsCall) Context(ctx context.Context) *V1beta1GetEidparamsCall {
  3873. c.ctx_ = ctx
  3874. return c
  3875. }
  3876. // Header returns an http.Header that can be modified by the caller to
  3877. // add HTTP headers to the request.
  3878. func (c *V1beta1GetEidparamsCall) Header() http.Header {
  3879. if c.header_ == nil {
  3880. c.header_ = make(http.Header)
  3881. }
  3882. return c.header_
  3883. }
  3884. func (c *V1beta1GetEidparamsCall) doRequest(alt string) (*http.Response, error) {
  3885. reqHeaders := make(http.Header)
  3886. for k, v := range c.header_ {
  3887. reqHeaders[k] = v
  3888. }
  3889. reqHeaders.Set("User-Agent", c.s.userAgent())
  3890. if c.ifNoneMatch_ != "" {
  3891. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3892. }
  3893. var body io.Reader = nil
  3894. c.urlParams_.Set("alt", alt)
  3895. c.urlParams_.Set("prettyPrint", "false")
  3896. urls := googleapi.ResolveRelative(c.s.BasePath, "v1beta1/eidparams")
  3897. urls += "?" + c.urlParams_.Encode()
  3898. req, err := http.NewRequest("GET", urls, body)
  3899. if err != nil {
  3900. return nil, err
  3901. }
  3902. req.Header = reqHeaders
  3903. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3904. }
  3905. // Do executes the "proximitybeacon.getEidparams" call.
  3906. // Exactly one of *EphemeralIdRegistrationParams or error will be
  3907. // non-nil. Any non-2xx status code is an error. Response headers are in
  3908. // either *EphemeralIdRegistrationParams.ServerResponse.Header or (if a
  3909. // response was returned at all) in error.(*googleapi.Error).Header. Use
  3910. // googleapi.IsNotModified to check whether the returned error was
  3911. // because http.StatusNotModified was returned.
  3912. func (c *V1beta1GetEidparamsCall) Do(opts ...googleapi.CallOption) (*EphemeralIdRegistrationParams, error) {
  3913. gensupport.SetOptions(c.urlParams_, opts...)
  3914. res, err := c.doRequest("json")
  3915. if res != nil && res.StatusCode == http.StatusNotModified {
  3916. if res.Body != nil {
  3917. res.Body.Close()
  3918. }
  3919. return nil, &googleapi.Error{
  3920. Code: res.StatusCode,
  3921. Header: res.Header,
  3922. }
  3923. }
  3924. if err != nil {
  3925. return nil, err
  3926. }
  3927. defer googleapi.CloseBody(res)
  3928. if err := googleapi.CheckResponse(res); err != nil {
  3929. return nil, err
  3930. }
  3931. ret := &EphemeralIdRegistrationParams{
  3932. ServerResponse: googleapi.ServerResponse{
  3933. Header: res.Header,
  3934. HTTPStatusCode: res.StatusCode,
  3935. },
  3936. }
  3937. target := &ret
  3938. if err := gensupport.DecodeResponse(target, res); err != nil {
  3939. return nil, err
  3940. }
  3941. return ret, nil
  3942. // {
  3943. // "description": "Gets the Proximity Beacon API's current public key and associated\nparameters used to initiate the Diffie-Hellman key exchange required to\nregister a beacon that broadcasts the Eddystone-EID format. This key\nchanges periodically; clients may cache it and re-use the same public key\nto provision and register multiple beacons. However, clients should be\nprepared to refresh this key when they encounter an error registering an\nEddystone-EID beacon.",
  3944. // "flatPath": "v1beta1/eidparams",
  3945. // "httpMethod": "GET",
  3946. // "id": "proximitybeacon.getEidparams",
  3947. // "parameterOrder": [],
  3948. // "parameters": {},
  3949. // "path": "v1beta1/eidparams",
  3950. // "response": {
  3951. // "$ref": "EphemeralIdRegistrationParams"
  3952. // },
  3953. // "scopes": [
  3954. // "https://www.googleapis.com/auth/userlocation.beacon.registry"
  3955. // ]
  3956. // }
  3957. }