Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

657 Zeilen
24 KiB

  1. // Copyright 2018 Google Inc. All rights reserved.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // AUTO-GENERATED CODE. DO NOT EDIT.
  5. // Package firebaseremoteconfig provides access to the Firebase Remote Config API.
  6. //
  7. // See https://firebase.google.com/docs/remote-config/
  8. //
  9. // Usage example:
  10. //
  11. // import "google.golang.org/api/firebaseremoteconfig/v1"
  12. // ...
  13. // firebaseremoteconfigService, err := firebaseremoteconfig.New(oauthHttpClient)
  14. package firebaseremoteconfig // import "google.golang.org/api/firebaseremoteconfig/v1"
  15. import (
  16. "bytes"
  17. "context"
  18. "encoding/json"
  19. "errors"
  20. "fmt"
  21. "io"
  22. "net/http"
  23. "net/url"
  24. "strconv"
  25. "strings"
  26. gensupport "google.golang.org/api/gensupport"
  27. googleapi "google.golang.org/api/googleapi"
  28. )
  29. // Always reference these packages, just in case the auto-generated code
  30. // below doesn't.
  31. var _ = bytes.NewBuffer
  32. var _ = strconv.Itoa
  33. var _ = fmt.Sprintf
  34. var _ = json.NewDecoder
  35. var _ = io.Copy
  36. var _ = url.Parse
  37. var _ = gensupport.MarshalJSON
  38. var _ = googleapi.Version
  39. var _ = errors.New
  40. var _ = strings.Replace
  41. var _ = context.Canceled
  42. const apiId = "firebaseremoteconfig:v1"
  43. const apiName = "firebaseremoteconfig"
  44. const apiVersion = "v1"
  45. const basePath = "https://firebaseremoteconfig.googleapis.com/"
  46. func New(client *http.Client) (*Service, error) {
  47. if client == nil {
  48. return nil, errors.New("client is nil")
  49. }
  50. s := &Service{client: client, BasePath: basePath}
  51. s.Projects = NewProjectsService(s)
  52. return s, nil
  53. }
  54. type Service struct {
  55. client *http.Client
  56. BasePath string // API endpoint base URL
  57. UserAgent string // optional additional User-Agent fragment
  58. Projects *ProjectsService
  59. }
  60. func (s *Service) userAgent() string {
  61. if s.UserAgent == "" {
  62. return googleapi.UserAgent
  63. }
  64. return googleapi.UserAgent + " " + s.UserAgent
  65. }
  66. func NewProjectsService(s *Service) *ProjectsService {
  67. rs := &ProjectsService{s: s}
  68. return rs
  69. }
  70. type ProjectsService struct {
  71. s *Service
  72. }
  73. // RemoteConfig: *
  74. // The RemoteConfig consists of a list of conditions (which can
  75. // be
  76. // thought of as named "if" statements) and a map of parameters
  77. // (parameter key
  78. // to a structure containing an optional default value, as well as a
  79. // optional
  80. // submap of (condition name to value when that condition is true).
  81. type RemoteConfig struct {
  82. // Conditions: The list of named conditions. The order *does* affect the
  83. // semantics.
  84. // The condition_name values of these entries must be unique.
  85. //
  86. // The resolved value of a config parameter P is determined as follow:
  87. // * Let Y be the set of values from the submap of P that refer to
  88. // conditions
  89. // that evaluate to <code>true</code>.
  90. // * If Y is non empty, the value is taken from the specific submap in Y
  91. // whose
  92. // condition_name is the earliest in this condition list.
  93. // * Else, if P has a default value option (condition_name is empty)
  94. // then
  95. // the value is taken from that option.
  96. // * Else, parameter P has no value and is omitted from the config
  97. // result.
  98. //
  99. // Example: parameter key "p1", default value "v1", submap specified
  100. // as
  101. // {"c1": v2, "c2": v3} where "c1" and "c2" are names of conditions in
  102. // the
  103. // condition list (where "c1" in this example appears before "c2").
  104. // The
  105. // value of p1 would be v2 as long as c1 is true. Otherwise, if c2 is
  106. // true,
  107. // p1 would evaluate to v3, and if c1 and c2 are both false, p1 would
  108. // evaluate
  109. // to v1. If no default value was specified, and c1 and c2 were both
  110. // false,
  111. // no value for p1 would be generated.
  112. Conditions []*RemoteConfigCondition `json:"conditions,omitempty"`
  113. // Parameters: Map of parameter keys to their optional default values
  114. // and optional submap
  115. // of (condition name : value). Order doesn't affect semantics, and so
  116. // is
  117. // sorted by the server. The 'key' values of the params must be unique.
  118. Parameters map[string]RemoteConfigParameter `json:"parameters,omitempty"`
  119. // ServerResponse contains the HTTP response code and headers from the
  120. // server.
  121. googleapi.ServerResponse `json:"-"`
  122. // ForceSendFields is a list of field names (e.g. "Conditions") to
  123. // unconditionally include in API requests. By default, fields with
  124. // empty values are omitted from API requests. However, any non-pointer,
  125. // non-interface field appearing in ForceSendFields will be sent to the
  126. // server regardless of whether the field is empty or not. This may be
  127. // used to include empty fields in Patch requests.
  128. ForceSendFields []string `json:"-"`
  129. // NullFields is a list of field names (e.g. "Conditions") to include in
  130. // API requests with the JSON null value. By default, fields with empty
  131. // values are omitted from API requests. However, any field with an
  132. // empty value appearing in NullFields will be sent to the server as
  133. // null. It is an error if a field in this list has a non-empty value.
  134. // This may be used to include null fields in Patch requests.
  135. NullFields []string `json:"-"`
  136. }
  137. func (s *RemoteConfig) MarshalJSON() ([]byte, error) {
  138. type NoMethod RemoteConfig
  139. raw := NoMethod(*s)
  140. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  141. }
  142. // RemoteConfigCondition: A single RemoteConfig Condition. A list of
  143. // these (because order matters) are
  144. // part of a single RemoteConfig template.
  145. type RemoteConfigCondition struct {
  146. // Description: DO NOT USE. Implementation removed and will not be added
  147. // unless requested.
  148. // A description for this Condition. Length must be less than or equal
  149. // to
  150. // 100 characters (or more precisely, unicode code points, which is
  151. // defined
  152. // in
  153. // java/com/google/wireless/android/config/ConstsExporter.java).
  154. // A description may contain any Unicode characters
  155. Description string `json:"description,omitempty"`
  156. // Expression: Required.
  157. Expression string `json:"expression,omitempty"`
  158. // Name: Required.
  159. // A non empty and unique name of this condition.
  160. Name string `json:"name,omitempty"`
  161. // TagColor: Optional.
  162. // The display (tag) color of this condition. This serves as part of a
  163. // tag
  164. // (in the future, we may add tag text as well as tag color, but that is
  165. // not
  166. // yet implemented in the UI).
  167. // This value has no affect on the semantics of the delivered config and
  168. // it
  169. // is ignored by the backend, except for passing it through
  170. // write/read
  171. // requests.
  172. // Not having this value or having the
  173. // "CONDITION_DISPLAY_COLOR_UNSPECIFIED"
  174. // value (0) have the same meaning: Let the UI choose any valid color
  175. // when
  176. // displaying the condition.
  177. //
  178. // Possible values:
  179. // "CONDITION_DISPLAY_COLOR_UNSPECIFIED"
  180. // "BLUE" - Blue
  181. // "BROWN" - Brown
  182. // "CYAN" - Cyan
  183. // "DEEP_ORANGE" - aka "Red Orange"
  184. // "GREEN" - Green
  185. // "INDIGO" - Indigo
  186. // *
  187. // "LIME" - Lime - Approved deviation from Material color palette
  188. // "ORANGE" - Orange
  189. // "PINK" - Pink
  190. // "PURPLE" - Purple
  191. // "TEAL" - Teal
  192. TagColor string `json:"tagColor,omitempty"`
  193. // ForceSendFields is a list of field names (e.g. "Description") to
  194. // unconditionally include in API requests. By default, fields with
  195. // empty values are omitted from API requests. However, any non-pointer,
  196. // non-interface field appearing in ForceSendFields will be sent to the
  197. // server regardless of whether the field is empty or not. This may be
  198. // used to include empty fields in Patch requests.
  199. ForceSendFields []string `json:"-"`
  200. // NullFields is a list of field names (e.g. "Description") to include
  201. // in API requests with the JSON null value. By default, fields with
  202. // empty values are omitted from API requests. However, any field with
  203. // an empty value appearing in NullFields will be sent to the server as
  204. // null. It is an error if a field in this list has a non-empty value.
  205. // This may be used to include null fields in Patch requests.
  206. NullFields []string `json:"-"`
  207. }
  208. func (s *RemoteConfigCondition) MarshalJSON() ([]byte, error) {
  209. type NoMethod RemoteConfigCondition
  210. raw := NoMethod(*s)
  211. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  212. }
  213. // RemoteConfigParameter: While default_value and conditional_values are
  214. // each optional, at least one of
  215. // the two is required - otherwise, the parameter is meaningless (and
  216. // an
  217. // exception will be thrown by the validation logic).
  218. type RemoteConfigParameter struct {
  219. // ConditionalValues: Optional - a map of (condition_name, value). The
  220. // condition_name of the
  221. // highest priority (the one listed first in the conditions array)
  222. // determines
  223. // the value of this parameter.
  224. ConditionalValues map[string]RemoteConfigParameterValue `json:"conditionalValues,omitempty"`
  225. // DefaultValue: Optional - value to set the parameter to, when none of
  226. // the named conditions
  227. // evaluate to <code>true</code>.
  228. DefaultValue *RemoteConfigParameterValue `json:"defaultValue,omitempty"`
  229. // Description: Optional.
  230. // A description for this Parameter. Length must be less than or equal
  231. // to
  232. // 100 characters (or more precisely, unicode code points, which is
  233. // defined
  234. // in
  235. // java/com/google/wireless/android/config/ConstsExporter.java).
  236. // A description may contain any Unicode characters
  237. Description string `json:"description,omitempty"`
  238. // ForceSendFields is a list of field names (e.g. "ConditionalValues")
  239. // to unconditionally include in API requests. By default, fields with
  240. // empty values are omitted from API requests. However, any non-pointer,
  241. // non-interface field appearing in ForceSendFields will be sent to the
  242. // server regardless of whether the field is empty or not. This may be
  243. // used to include empty fields in Patch requests.
  244. ForceSendFields []string `json:"-"`
  245. // NullFields is a list of field names (e.g. "ConditionalValues") to
  246. // include in API requests with the JSON null value. By default, fields
  247. // with empty values are omitted from API requests. However, any field
  248. // with an empty value appearing in NullFields will be sent to the
  249. // server as null. It is an error if a field in this list has a
  250. // non-empty value. This may be used to include null fields in Patch
  251. // requests.
  252. NullFields []string `json:"-"`
  253. }
  254. func (s *RemoteConfigParameter) MarshalJSON() ([]byte, error) {
  255. type NoMethod RemoteConfigParameter
  256. raw := NoMethod(*s)
  257. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  258. }
  259. // RemoteConfigParameterValue: A RemoteConfigParameter's "value" (either
  260. // the default value, or the value
  261. // associated with a condition name) is either a string, or
  262. // the
  263. // "use_in_app_default" indicator (which means to leave out the
  264. // parameter from
  265. // the returned <key, value> map that is the output of the parameter
  266. // fetch).
  267. // We represent the "use_in_app_default" as a bool, but (when using the
  268. // boolean
  269. // instead of the string) it should always be <code>true</code>.
  270. type RemoteConfigParameterValue struct {
  271. // UseInAppDefault: if true, omit the parameter from the map of fetched
  272. // parameter values
  273. UseInAppDefault bool `json:"useInAppDefault,omitempty"`
  274. // Value: the string to set the parameter to
  275. Value string `json:"value,omitempty"`
  276. // ForceSendFields is a list of field names (e.g. "UseInAppDefault") to
  277. // unconditionally include in API requests. By default, fields with
  278. // empty values are omitted from API requests. However, any non-pointer,
  279. // non-interface field appearing in ForceSendFields will be sent to the
  280. // server regardless of whether the field is empty or not. This may be
  281. // used to include empty fields in Patch requests.
  282. ForceSendFields []string `json:"-"`
  283. // NullFields is a list of field names (e.g. "UseInAppDefault") to
  284. // include in API requests with the JSON null value. By default, fields
  285. // with empty values are omitted from API requests. However, any field
  286. // with an empty value appearing in NullFields will be sent to the
  287. // server as null. It is an error if a field in this list has a
  288. // non-empty value. This may be used to include null fields in Patch
  289. // requests.
  290. NullFields []string `json:"-"`
  291. }
  292. func (s *RemoteConfigParameterValue) MarshalJSON() ([]byte, error) {
  293. type NoMethod RemoteConfigParameterValue
  294. raw := NoMethod(*s)
  295. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  296. }
  297. // method id "firebaseremoteconfig.projects.getRemoteConfig":
  298. type ProjectsGetRemoteConfigCall struct {
  299. s *Service
  300. projectid string
  301. urlParams_ gensupport.URLParams
  302. ifNoneMatch_ string
  303. ctx_ context.Context
  304. header_ http.Header
  305. }
  306. // GetRemoteConfig: Get the latest version Remote Configuration for a
  307. // project.
  308. // Returns the RemoteConfig as the payload, and also the eTag as
  309. // a
  310. // response header.
  311. func (r *ProjectsService) GetRemoteConfig(projectid string) *ProjectsGetRemoteConfigCall {
  312. c := &ProjectsGetRemoteConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  313. c.projectid = projectid
  314. return c
  315. }
  316. // Fields allows partial responses to be retrieved. See
  317. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  318. // for more information.
  319. func (c *ProjectsGetRemoteConfigCall) Fields(s ...googleapi.Field) *ProjectsGetRemoteConfigCall {
  320. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  321. return c
  322. }
  323. // IfNoneMatch sets the optional parameter which makes the operation
  324. // fail if the object's ETag matches the given value. This is useful for
  325. // getting updates only after the object has changed since the last
  326. // request. Use googleapi.IsNotModified to check whether the response
  327. // error from Do is the result of In-None-Match.
  328. func (c *ProjectsGetRemoteConfigCall) IfNoneMatch(entityTag string) *ProjectsGetRemoteConfigCall {
  329. c.ifNoneMatch_ = entityTag
  330. return c
  331. }
  332. // Context sets the context to be used in this call's Do method. Any
  333. // pending HTTP request will be aborted if the provided context is
  334. // canceled.
  335. func (c *ProjectsGetRemoteConfigCall) Context(ctx context.Context) *ProjectsGetRemoteConfigCall {
  336. c.ctx_ = ctx
  337. return c
  338. }
  339. // Header returns an http.Header that can be modified by the caller to
  340. // add HTTP headers to the request.
  341. func (c *ProjectsGetRemoteConfigCall) Header() http.Header {
  342. if c.header_ == nil {
  343. c.header_ = make(http.Header)
  344. }
  345. return c.header_
  346. }
  347. func (c *ProjectsGetRemoteConfigCall) doRequest(alt string) (*http.Response, error) {
  348. reqHeaders := make(http.Header)
  349. for k, v := range c.header_ {
  350. reqHeaders[k] = v
  351. }
  352. reqHeaders.Set("User-Agent", c.s.userAgent())
  353. if c.ifNoneMatch_ != "" {
  354. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  355. }
  356. var body io.Reader = nil
  357. c.urlParams_.Set("alt", alt)
  358. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+project}/remoteConfig")
  359. urls += "?" + c.urlParams_.Encode()
  360. req, _ := http.NewRequest("GET", urls, body)
  361. req.Header = reqHeaders
  362. googleapi.Expand(req.URL, map[string]string{
  363. "project": c.projectid,
  364. })
  365. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  366. }
  367. // Do executes the "firebaseremoteconfig.projects.getRemoteConfig" call.
  368. // Exactly one of *RemoteConfig or error will be non-nil. Any non-2xx
  369. // status code is an error. Response headers are in either
  370. // *RemoteConfig.ServerResponse.Header or (if a response was returned at
  371. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  372. // to check whether the returned error was because
  373. // http.StatusNotModified was returned.
  374. func (c *ProjectsGetRemoteConfigCall) Do(opts ...googleapi.CallOption) (*RemoteConfig, error) {
  375. gensupport.SetOptions(c.urlParams_, opts...)
  376. res, err := c.doRequest("json")
  377. if res != nil && res.StatusCode == http.StatusNotModified {
  378. if res.Body != nil {
  379. res.Body.Close()
  380. }
  381. return nil, &googleapi.Error{
  382. Code: res.StatusCode,
  383. Header: res.Header,
  384. }
  385. }
  386. if err != nil {
  387. return nil, err
  388. }
  389. defer googleapi.CloseBody(res)
  390. if err := googleapi.CheckResponse(res); err != nil {
  391. return nil, err
  392. }
  393. ret := &RemoteConfig{
  394. ServerResponse: googleapi.ServerResponse{
  395. Header: res.Header,
  396. HTTPStatusCode: res.StatusCode,
  397. },
  398. }
  399. target := &ret
  400. if err := gensupport.DecodeResponse(target, res); err != nil {
  401. return nil, err
  402. }
  403. return ret, nil
  404. // {
  405. // "description": "Get the latest version Remote Configuration for a project.\nReturns the RemoteConfig as the payload, and also the eTag as a\nresponse header.",
  406. // "flatPath": "v1/projects/{projectsId}/remoteConfig",
  407. // "httpMethod": "GET",
  408. // "id": "firebaseremoteconfig.projects.getRemoteConfig",
  409. // "parameterOrder": [
  410. // "project"
  411. // ],
  412. // "parameters": {
  413. // "project": {
  414. // "description": "The GMP project identifier. Required.\nSee note at the beginning of this file regarding project ids.",
  415. // "location": "path",
  416. // "pattern": "^projects/[^/]+$",
  417. // "required": true,
  418. // "type": "string"
  419. // }
  420. // },
  421. // "path": "v1/{+project}/remoteConfig",
  422. // "response": {
  423. // "$ref": "RemoteConfig"
  424. // }
  425. // }
  426. }
  427. // method id "firebaseremoteconfig.projects.updateRemoteConfig":
  428. type ProjectsUpdateRemoteConfigCall struct {
  429. s *Service
  430. projectid string
  431. remoteconfig *RemoteConfig
  432. urlParams_ gensupport.URLParams
  433. ctx_ context.Context
  434. header_ http.Header
  435. }
  436. // UpdateRemoteConfig: Update a RemoteConfig. We treat this as an
  437. // always-existing
  438. // resource (when it is not found in our data store, we treat it as
  439. // version
  440. // 0, a template with zero conditions and zero parameters). Hence there
  441. // are
  442. // no Create or Delete operations. Returns the updated template
  443. // when
  444. // successful (and the updated eTag as a response header), or an error
  445. // if
  446. // things go wrong.
  447. // Possible error messages:
  448. // * VALIDATION_ERROR (HTTP status 400) with additional details if
  449. // the
  450. // template being passed in can not be validated.
  451. // * AUTHENTICATION_ERROR (HTTP status 401) if the request can not
  452. // be
  453. // authenticate (e.g. no access token, or invalid access token).
  454. // * AUTHORIZATION_ERROR (HTTP status 403) if the request can not
  455. // be
  456. // authorized (e.g. the user has no access to the specified project
  457. // id).
  458. // * VERSION_MISMATCH (HTTP status 412) when trying to update when
  459. // the
  460. // expected eTag (passed in via the "If-match" header) is not specified,
  461. // or
  462. // is specified but does does not match the current eTag.
  463. // * Internal error (HTTP status 500) for Database problems or other
  464. // internal
  465. // errors.
  466. func (r *ProjectsService) UpdateRemoteConfig(projectid string, remoteconfig *RemoteConfig) *ProjectsUpdateRemoteConfigCall {
  467. c := &ProjectsUpdateRemoteConfigCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  468. c.projectid = projectid
  469. c.remoteconfig = remoteconfig
  470. return c
  471. }
  472. // ValidateOnly sets the optional parameter "validateOnly": Defaults to
  473. // <code>false</code> (UpdateRemoteConfig call should
  474. // update the backend if there are no validation/interal errors). May be
  475. // set
  476. // to <code>true</code> to indicate that, should no validation errors
  477. // occur,
  478. // the call should return a "200 OK" instead of performing the update.
  479. // Note
  480. // that other error messages (500 Internal Error, 412 Version Mismatch,
  481. // etc)
  482. // may still result after flipping to <code>false</code>, even if
  483. // getting a
  484. // "200 OK" when calling with <code>true</code>.
  485. func (c *ProjectsUpdateRemoteConfigCall) ValidateOnly(validateOnly bool) *ProjectsUpdateRemoteConfigCall {
  486. c.urlParams_.Set("validateOnly", fmt.Sprint(validateOnly))
  487. return c
  488. }
  489. // Fields allows partial responses to be retrieved. See
  490. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  491. // for more information.
  492. func (c *ProjectsUpdateRemoteConfigCall) Fields(s ...googleapi.Field) *ProjectsUpdateRemoteConfigCall {
  493. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  494. return c
  495. }
  496. // Context sets the context to be used in this call's Do method. Any
  497. // pending HTTP request will be aborted if the provided context is
  498. // canceled.
  499. func (c *ProjectsUpdateRemoteConfigCall) Context(ctx context.Context) *ProjectsUpdateRemoteConfigCall {
  500. c.ctx_ = ctx
  501. return c
  502. }
  503. // Header returns an http.Header that can be modified by the caller to
  504. // add HTTP headers to the request.
  505. func (c *ProjectsUpdateRemoteConfigCall) Header() http.Header {
  506. if c.header_ == nil {
  507. c.header_ = make(http.Header)
  508. }
  509. return c.header_
  510. }
  511. func (c *ProjectsUpdateRemoteConfigCall) doRequest(alt string) (*http.Response, error) {
  512. reqHeaders := make(http.Header)
  513. for k, v := range c.header_ {
  514. reqHeaders[k] = v
  515. }
  516. reqHeaders.Set("User-Agent", c.s.userAgent())
  517. var body io.Reader = nil
  518. body, err := googleapi.WithoutDataWrapper.JSONReader(c.remoteconfig)
  519. if err != nil {
  520. return nil, err
  521. }
  522. reqHeaders.Set("Content-Type", "application/json")
  523. c.urlParams_.Set("alt", alt)
  524. urls := googleapi.ResolveRelative(c.s.BasePath, "v1/{+project}/remoteConfig")
  525. urls += "?" + c.urlParams_.Encode()
  526. req, _ := http.NewRequest("PUT", urls, body)
  527. req.Header = reqHeaders
  528. googleapi.Expand(req.URL, map[string]string{
  529. "project": c.projectid,
  530. })
  531. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  532. }
  533. // Do executes the "firebaseremoteconfig.projects.updateRemoteConfig" call.
  534. // Exactly one of *RemoteConfig or error will be non-nil. Any non-2xx
  535. // status code is an error. Response headers are in either
  536. // *RemoteConfig.ServerResponse.Header or (if a response was returned at
  537. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  538. // to check whether the returned error was because
  539. // http.StatusNotModified was returned.
  540. func (c *ProjectsUpdateRemoteConfigCall) Do(opts ...googleapi.CallOption) (*RemoteConfig, error) {
  541. gensupport.SetOptions(c.urlParams_, opts...)
  542. res, err := c.doRequest("json")
  543. if res != nil && res.StatusCode == http.StatusNotModified {
  544. if res.Body != nil {
  545. res.Body.Close()
  546. }
  547. return nil, &googleapi.Error{
  548. Code: res.StatusCode,
  549. Header: res.Header,
  550. }
  551. }
  552. if err != nil {
  553. return nil, err
  554. }
  555. defer googleapi.CloseBody(res)
  556. if err := googleapi.CheckResponse(res); err != nil {
  557. return nil, err
  558. }
  559. ret := &RemoteConfig{
  560. ServerResponse: googleapi.ServerResponse{
  561. Header: res.Header,
  562. HTTPStatusCode: res.StatusCode,
  563. },
  564. }
  565. target := &ret
  566. if err := gensupport.DecodeResponse(target, res); err != nil {
  567. return nil, err
  568. }
  569. return ret, nil
  570. // {
  571. // "description": "Update a RemoteConfig. We treat this as an always-existing\nresource (when it is not found in our data store, we treat it as version\n0, a template with zero conditions and zero parameters). Hence there are\nno Create or Delete operations. Returns the updated template when\nsuccessful (and the updated eTag as a response header), or an error if\nthings go wrong.\nPossible error messages:\n* VALIDATION_ERROR (HTTP status 400) with additional details if the\ntemplate being passed in can not be validated.\n* AUTHENTICATION_ERROR (HTTP status 401) if the request can not be\nauthenticate (e.g. no access token, or invalid access token).\n* AUTHORIZATION_ERROR (HTTP status 403) if the request can not be\nauthorized (e.g. the user has no access to the specified project id).\n* VERSION_MISMATCH (HTTP status 412) when trying to update when the\nexpected eTag (passed in via the \"If-match\" header) is not specified, or\nis specified but does does not match the current eTag.\n* Internal error (HTTP status 500) for Database problems or other internal\nerrors.",
  572. // "flatPath": "v1/projects/{projectsId}/remoteConfig",
  573. // "httpMethod": "PUT",
  574. // "id": "firebaseremoteconfig.projects.updateRemoteConfig",
  575. // "parameterOrder": [
  576. // "project"
  577. // ],
  578. // "parameters": {
  579. // "project": {
  580. // "description": "The GMP project identifier. Required.\nSee note at the beginning of this file regarding project ids.",
  581. // "location": "path",
  582. // "pattern": "^projects/[^/]+$",
  583. // "required": true,
  584. // "type": "string"
  585. // },
  586. // "validateOnly": {
  587. // "description": "Optional. Defaults to \u003ccode\u003efalse\u003c/code\u003e (UpdateRemoteConfig call should\nupdate the backend if there are no validation/interal errors). May be set\nto \u003ccode\u003etrue\u003c/code\u003e to indicate that, should no validation errors occur,\nthe call should return a \"200 OK\" instead of performing the update. Note\nthat other error messages (500 Internal Error, 412 Version Mismatch, etc)\nmay still result after flipping to \u003ccode\u003efalse\u003c/code\u003e, even if getting a\n\"200 OK\" when calling with \u003ccode\u003etrue\u003c/code\u003e.",
  588. // "location": "query",
  589. // "type": "boolean"
  590. // }
  591. // },
  592. // "path": "v1/{+project}/remoteConfig",
  593. // "request": {
  594. // "$ref": "RemoteConfig"
  595. // },
  596. // "response": {
  597. // "$ref": "RemoteConfig"
  598. // }
  599. // }
  600. }