nimbus/stateful/client/http_client.rs
1/* This Source Code Form is subject to the terms of the Mozilla Public
2 * License, v. 2.0. If a copy of the MPL was not distributed with this
3 * file, You can obtain one at https://mozilla.org/MPL/2.0/. */
4
5//! This is a simple HTTP client that uses viaduct to retrieve experiment data from the server.
6//! Currently configured to use Kinto and the old schema, although that would change once we start
7//! working on the real Nimbus schema.
8//!
9//! In the future we might replace this with a more fully-feature Remote Settings client, such as:
10//!
11//! https://github.com/mozilla-services/remote-settings-client
12//! Issue: https://github.com/mozilla/application-services/issues/3475
13//!
14//! But the simple subset implemented here meets our needs for now.
15
16use crate::error::Result;
17use crate::schema::parse_experiments;
18use crate::stateful::client::{Experiment, SettingsClient};
19use remote_settings::RemoteSettings;
20
21impl SettingsClient for RemoteSettings {
22 fn get_experiments_metadata(&self) -> Result<String> {
23 unimplemented!();
24 }
25
26 fn fetch_experiments(&self) -> Result<Vec<Experiment>> {
27 let resp = self.get_records_raw()?;
28 parse_experiments(&resp.text())
29 }
30}