From 8b03451e1f127513880004f99c627b761062a00a Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Sun, 10 Nov 2024 19:24:01 +0100 Subject: [PATCH 01/28] refactor construction --- agdb_server/src/db_pool.rs | 135 ++++++++------------------- agdb_server/src/db_pool/server_db.rs | 79 +++++++++++++++- 2 files changed, 112 insertions(+), 102 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 43f9b5d8..5a534277 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -77,77 +77,35 @@ impl DbPool { let db_exists = Path::new(&config.data_dir) .join("agdb_server.agdb") .exists(); - let db_pool = Self(Arc::new(DbPoolImpl { - server_db: ServerDb::new(&format!("mapped:{}/agdb_server.agdb", config.data_dir))?, - pool: RwLock::new(HashMap::new()), - })); - if db_exists { + Ok(if db_exists { + let db_pool = Self(Arc::new(DbPoolImpl { + server_db: ServerDb::load(&format!("mapped:{}/agdb_server.agdb", config.data_dir))?, + pool: RwLock::new(HashMap::new()), + })); + if db_pool .0 .server_db - .get() - .await - .exec( - QueryBuilder::search() - .depth_first() - .from("users") - .limit(1) - .where_() - .distance(CountComparison::Equal(2)) - .and() - .key("username") - .value(Comparison::Equal(config.admin.clone().into())) - .query(), - )? - .result - == 0 + .find_user_id(&config.admin) + .await? + .is_none() { let admin_password = Password::create(&config.admin, &config.admin); - - db_pool.0.server_db.get_mut().await.transaction_mut(|t| { - let admin = t.exec_mut( - QueryBuilder::insert() - .element(&ServerUser { - db_id: None, - username: config.admin.clone(), - password: admin_password.password.to_vec(), - salt: admin_password.user_salt.to_vec(), - token: String::new(), - }) - .query(), - )?; - - t.exec_mut( - QueryBuilder::insert() - .edges() - .from("users") - .to(admin) - .query(), - ) - })?; + db_pool + .0 + .server_db + .insert_user(ServerUser { + db_id: None, + username: config.admin.clone(), + password: admin_password.password.to_vec(), + salt: admin_password.user_salt.to_vec(), + token: String::new(), + }) + .await?; } - let dbs: Vec = db_pool - .0 - .server_db - .get() - .await - .exec( - QueryBuilder::select() - .elements::() - .ids( - QueryBuilder::search() - .from("dbs") - .where_() - .distance(CountComparison::Equal(2)) - .query(), - ) - .query(), - )? - .try_into()?; - - for db in dbs { + for db in db_pool.0.server_db.dbs().await? { let (owner, db_name) = db.name.split_once('/').ok_or(ErrorCode::DbInvalid)?; let db_path = db_file(owner, db_name, config); std::fs::create_dir_all(db_audit_dir(owner, config))?; @@ -155,43 +113,24 @@ impl DbPool { UserDb::new(&format!("{}:{}", db.db_type, db_path.to_string_lossy()))?; db_pool.0.pool.write().await.insert(db.name, server_db); } + + db_pool } else { let admin_password = Password::create(&config.admin, &config.admin); - - db_pool.0.server_db.get_mut().await.transaction_mut(|t| { - t.exec_mut(QueryBuilder::insert().index("username").query())?; - t.exec_mut(QueryBuilder::insert().index("token").query())?; - - t.exec_mut( - QueryBuilder::insert() - .nodes() - .aliases(["users", "dbs"]) - .query(), - )?; - - let admin = t.exec_mut( - QueryBuilder::insert() - .element(&ServerUser { - db_id: None, - username: config.admin.clone(), - password: admin_password.password.to_vec(), - salt: admin_password.user_salt.to_vec(), - token: String::new(), - }) - .query(), - )?; - - t.exec_mut( - QueryBuilder::insert() - .edges() - .from("users") - .to(admin) - .query(), - ) - })?; - } - - Ok(db_pool) + Self(Arc::new(DbPoolImpl { + server_db: ServerDb::new( + &format!("mapped:{}/agdb_server.agdb", config.data_dir), + ServerUser { + db_id: None, + username: config.admin.clone(), + password: admin_password.password.to_vec(), + salt: admin_password.user_salt.to_vec(), + token: String::new(), + }, + )?, + pool: RwLock::new(HashMap::new()), + })) + }) } pub(crate) async fn add_db( diff --git a/agdb_server/src/db_pool/server_db.rs b/agdb_server/src/db_pool/server_db.rs index 8203490a..7884ee2f 100644 --- a/agdb_server/src/db_pool/server_db.rs +++ b/agdb_server/src/db_pool/server_db.rs @@ -1,6 +1,11 @@ use crate::db_pool::user_db_storage::UserDbStorage; +use crate::db_pool::Database; +use crate::db_pool::ServerUser; use crate::server_error::ServerResult; +use agdb::CountComparison; +use agdb::DbId; use agdb::DbImpl; +use agdb::QueryBuilder; use std::sync::Arc; use tokio::sync::RwLock; use tokio::sync::RwLockReadGuard; @@ -9,11 +14,12 @@ use tokio::sync::RwLockWriteGuard; pub(crate) type ServerDbImpl = DbImpl; pub(crate) struct ServerDb(pub(crate) Arc>); -impl ServerDb { - pub(crate) fn new(name: &str) -> ServerResult { - Ok(Self(Arc::new(RwLock::new(ServerDbImpl::new(name)?)))) - } +const DBS: &str = "dbs"; +const USERS: &str = "users"; +const USERNAME: &str = "username"; +const TOKEN: &str = "token"; +impl ServerDb { pub(crate) async fn get(&self) -> RwLockReadGuard { self.0.read().await } @@ -21,4 +27,69 @@ impl ServerDb { pub(crate) async fn get_mut(&self) -> RwLockWriteGuard { self.0.write().await } + + pub(crate) fn load(name: &str) -> ServerResult { + Ok(Self(Arc::new(RwLock::new(ServerDbImpl::new(name)?)))) + } + + pub(crate) fn new(name: &str, admin: ServerUser) -> ServerResult { + let mut db = ServerDbImpl::new(name)?; + + db.transaction_mut(|t| { + t.exec_mut(QueryBuilder::insert().index(USERNAME).query())?; + t.exec_mut(QueryBuilder::insert().index(TOKEN).query())?; + t.exec_mut(QueryBuilder::insert().nodes().aliases([USERS, DBS]).query())?; + let id = t + .exec_mut(QueryBuilder::insert().element(&admin).query())? + .elements[0] + .id; + t.exec_mut(QueryBuilder::insert().edges().from(USERS).to(id).query()) + })?; + + Ok(Self(Arc::new(RwLock::new(db)))) + } + + pub(crate) async fn find_user_id(&self, username: &str) -> ServerResult> { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::search() + .index(USERNAME) + .value(username) + .query(), + )? + .elements + .first() + .map(|e| e.id)) + } + + pub(crate) async fn insert_user(&self, user: ServerUser) -> ServerResult { + self.0.write().await.transaction_mut(|t| { + let id = t + .exec_mut(QueryBuilder::insert().element(&user).query())? + .elements[0] + .id; + t.exec_mut(QueryBuilder::insert().edges().from(USERS).to(id).query())?; + Ok(id) + }) + } + + pub(crate) async fn dbs(&self) -> ServerResult> { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::select() + .elements::() + .search() + .from(DBS) + .where_() + .distance(CountComparison::Equal(2)) + .query(), + )? + .try_into()?) + } } From 586d96a1ae18c722b1079d25b9ea50fd1d95bbab Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 19:48:46 +0100 Subject: [PATCH 02/28] wip --- agdb_server/src/db_pool.rs | 739 +++++---------------------- agdb_server/src/db_pool/server_db.rs | 95 ---- agdb_server/src/main.rs | 1 + agdb_server/src/server_db.rs | 563 ++++++++++++++++++++ agdb_server/src/server_state.rs | 16 +- agdb_server/src/user_id.rs | 21 +- 6 files changed, 726 insertions(+), 709 deletions(-) delete mode 100644 agdb_server/src/db_pool/server_db.rs create mode 100644 agdb_server/src/server_db.rs diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 5a534277..a55c4d68 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -1,25 +1,17 @@ -mod server_db; mod user_db; mod user_db_storage; use crate::config::Config; -use crate::db_pool::server_db::ServerDb; use crate::error_code::ErrorCode; use crate::password; use crate::password::Password; +use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResult; use crate::utilities::get_size; -use agdb::Comparison; -use agdb::CountComparison; use agdb::DbId; -use agdb::DbUserValue; -use agdb::QueryBuilder; -use agdb::QueryId; use agdb::QueryResult; use agdb::QueryType; -use agdb::SearchQuery; -use agdb::UserValue; use agdb_api::AdminStatus; use agdb_api::DbAudit; use agdb_api::DbResource; @@ -28,7 +20,6 @@ use agdb_api::DbUser; use agdb_api::DbUserRole; use agdb_api::Queries; use agdb_api::ServerDatabase; -use agdb_api::UserStatus; use axum::http::StatusCode; use std::collections::HashMap; use std::io::Seek; @@ -43,26 +34,8 @@ use tokio::sync::RwLock; use tokio::sync::RwLockReadGuard; use tokio::sync::RwLockWriteGuard; use user_db::UserDb; -use user_db::UserDbImpl; use uuid::Uuid; -#[derive(UserValue)] -pub(crate) struct ServerUser { - pub(crate) db_id: Option, - pub(crate) username: String, - pub(crate) password: Vec, - pub(crate) salt: Vec, - pub(crate) token: String, -} - -#[derive(UserValue)] -struct Database { - pub(crate) db_id: Option, - pub(crate) name: String, - pub(crate) db_type: DbType, - pub(crate) backup: u64, -} - pub(crate) struct DbPoolImpl { server_db: ServerDb, pool: RwLock>, @@ -88,8 +61,8 @@ impl DbPool { .0 .server_db .find_user_id(&config.admin) - .await? - .is_none() + .await + .is_ok() { let admin_password = Password::create(&config.admin, &config.admin); db_pool @@ -140,10 +113,16 @@ impl DbPool { db_type: DbType, config: &Config, ) -> ServerResult { - let owner_id = self.find_user_id(owner).await?; + let owner_id = self.0.server_db.user_id(owner).await?; let db_name = db_name(owner, db); - if self.find_user_db(owner_id, &db_name).await.is_ok() { + if self + .0 + .server_db + .find_user_db_id(owner_id, &db_name) + .await? + .is_some() + { return Err(ErrorCode::DbExists.into()); } @@ -164,27 +143,18 @@ impl DbPool { }; self.get_pool_mut().await.insert(db_name.clone(), server_db); - self.db_mut().await.transaction_mut(|t| { - let db = t.exec_mut( - QueryBuilder::insert() - .element(&Database { - db_id: None, - name: db_name.clone(), - db_type, - backup, - }) - .query(), - )?; - - t.exec_mut( - QueryBuilder::insert() - .edges() - .from([QueryId::from(owner_id), "dbs".into()]) - .to(db) - .values([vec![("role", DbUserRole::Admin).into()], vec![]]) - .query(), + self.0 + .server_db + .insert_db( + owner_id, + Database { + db_id: None, + name: db_name.clone(), + db_type, + backup, + }, ) - })?; + .await?; Ok(()) } @@ -202,60 +172,19 @@ impl DbPool { } let db_name = db_name(owner, db); - let db_id = self.find_user_db_id(user, &db_name).await?; - - if !self.is_db_admin(user, db_id).await? { + let db_id = self + .0 + .server_db + .find_user_db_id(user, &db_name) + .await? + .ok_or(db_not_found(&db_name))?; + + if !self.0.server_db.is_db_admin(user, db_id).await? { return Err(permission_denied("admin only")); } - let user_id = self.find_user_id(username).await?; - - self.db_mut().await.transaction_mut(|t| { - let existing_role = t.exec( - QueryBuilder::search() - .from(user_id) - .to(db_id) - .limit(1) - .where_() - .keys("role") - .query(), - )?; - - if existing_role.result == 1 { - t.exec_mut( - QueryBuilder::insert() - .values([[("role", role).into()]]) - .ids(existing_role) - .query(), - )?; - } else { - t.exec_mut( - QueryBuilder::insert() - .edges() - .from(user_id) - .to(db_id) - .values_uniform([("role", role).into()]) - .query(), - )?; - } - - Ok(()) - }) - } - - pub(crate) async fn add_user(&self, user: ServerUser) -> ServerResult { - self.db_mut().await.transaction_mut(|t| { - let user = t.exec_mut(QueryBuilder::insert().element(&user).query())?; - - t.exec_mut( - QueryBuilder::insert() - .edges() - .from("users") - .to(user) - .query(), - ) - })?; - Ok(()) + let user_id = self.0.server_db.user_id(username).await?; + self.0.server_db.insert_db_user(db_id, user_id, role).await } pub(crate) async fn audit( @@ -266,7 +195,11 @@ impl DbPool { config: &Config, ) -> ServerResult { let db_name = db_name(owner, db); - self.find_user_db_id(user, &db_name).await?; + self.0 + .server_db + .find_user_db_id(user, &db_name) + .await? + .ok_or(db_not_found(&db_name))?; if let Ok(log) = std::fs::OpenOptions::new() .read(true) @@ -286,9 +219,14 @@ impl DbPool { config: &Config, ) -> ServerResult { let db_name = db_name(owner, db); - let mut database = self.find_user_db(user, &db_name).await?; + let mut database = self.0.server_db.user_db(user, &db_name).await?; - if !self.is_db_admin(user, database.db_id.unwrap()).await? { + if !self + .0 + .server_db + .is_db_admin(user, database.db_id.unwrap()) + .await? + { return Err(permission_denied("admin only")); } @@ -298,9 +236,7 @@ impl DbPool { .ok_or(db_not_found(&database.name))?; self.do_backup(owner, db, config, server_db, &mut database) - .await?; - - Ok(()) + .await } pub(crate) async fn change_password( @@ -312,9 +248,7 @@ impl DbPool { let pswd = Password::create(&user.username, new_password); user.password = pswd.password.to_vec(); user.salt = pswd.user_salt.to_vec(); - self.save_user(user).await?; - - Ok(()) + self.0.server_db.save_user(user).await } pub(crate) async fn clear_db( @@ -326,8 +260,8 @@ impl DbPool { resource: DbResource, ) -> ServerResult { let db_name = db_name(owner, db); - let mut database = self.find_user_db(user, &db_name).await?; - let role = self.find_user_db_role(user, &db_name).await?; + let mut database = self.0.server_db.user_db(user, &db_name).await?; + let role = self.0.server_db.user_db_role(user, &db_name).await?; if role != DbUserRole::Admin { return Err(permission_denied("admin only")); @@ -387,7 +321,7 @@ impl DbPool { std::fs::remove_file(&backup_file)?; } database.backup = 0; - self.save_db(&*database).await?; + self.0.server_db.save_db(database).await?; Ok(()) } @@ -446,7 +380,7 @@ impl DbPool { .await?; database.backup = SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(); - self.save_db(database).await?; + self.0.server_db.save_db(database).await?; Ok(()) } @@ -459,13 +393,18 @@ impl DbPool { config: &Config, ) -> ServerResult { let db_name = db_name(owner, db); - let mut database = self.find_user_db(user, &db_name).await?; + let mut database = self.0.server_db.user_db(user, &db_name).await?; if database.db_type == db_type { return Ok(()); } - if !self.is_db_admin(user, database.db_id.unwrap()).await? { + if !self + .0 + .server_db + .is_db_admin(user, database.db_id.unwrap()) + .await? + { return Err(permission_denied("admin only")); } @@ -477,7 +416,7 @@ impl DbPool { pool.insert(db_name, server_db); database.db_type = db_type; - self.save_db(&database).await?; + self.0.server_db.save_db(&database).await?; Ok(()) } @@ -494,19 +433,25 @@ impl DbPool { let (new_owner, new_db) = new_name.split_once('/').ok_or(ErrorCode::DbInvalid)?; let source_db = db_name(owner, db); let target_db = db_name(new_owner, new_db); - let database = self.find_user_db(user, &source_db).await?; + let database = self.0.server_db.user_db(user, &source_db).await?; if admin { - user = self.find_user_id(new_owner).await?; + user = self.0.server_db.user_id(new_owner).await?; } else { - let username = self.user_name(user).await?; + let username = self.0.server_db.user_name(user).await?; if new_owner != username { return Err(permission_denied("cannot copy db to another user")); } }; - if self.find_user_db(user, &target_db).await.is_ok() { + if self + .0 + .server_db + .find_user_db_id(user, &target_db) + .await? + .is_some() + { return Err(ErrorCode::DbExists.into()); } @@ -533,27 +478,18 @@ impl DbPool { self.get_pool_mut() .await .insert(target_db.clone(), server_db); - self.db_mut().await.transaction_mut(|t| { - let db = t.exec_mut( - QueryBuilder::insert() - .element(&Database { - db_id: None, - name: target_db.clone(), - db_type: database.db_type, - backup: 0, - }) - .query(), - )?; - - t.exec_mut( - QueryBuilder::insert() - .edges() - .from([QueryId::from(user), "dbs".into()]) - .to(db) - .values([vec![("role", DbUserRole::Admin).into()], vec![]]) - .query(), + self.0 + .server_db + .insert_db( + user, + Database { + db_id: None, + name: target_db.clone(), + db_type: database.db_type, + backup: 0, + }, ) - })?; + .await?; Ok(()) } @@ -599,7 +535,7 @@ impl DbPool { config: &Config, ) -> ServerResult> { let db_name = db_name(owner, db); - let role = self.find_user_db_role(user, &db_name).await?; + let role = self.0.server_db.user_db_role(user, &db_name).await?; let required_role = required_role(&queries); if required_role == DbUserRole::Write && role == DbUserRole::Read { @@ -614,7 +550,7 @@ impl DbPool { .exec(queries) .await } else { - let username = self.user_name(user).await?; + let username = self.0.server_db.user_name(user).await?; let (r, audit) = self .get_pool() @@ -649,22 +585,7 @@ impl DbPool { pub(crate) async fn find_dbs(&self) -> ServerResult> { let pool = self.get_pool().await; - let dbs: Vec = self - .db() - .await - .exec( - QueryBuilder::select() - .elements::() - .ids( - QueryBuilder::search() - .from("dbs") - .where_() - .distance(CountComparison::Equal(2)) - .query(), - ) - .query(), - )? - .try_into()?; + let dbs = self.0.server_db.dbs().await?; let mut databases = Vec::with_capacity(dbs.len()); @@ -685,170 +606,41 @@ impl DbPool { Ok(databases) } - pub(crate) async fn find_users(&self) -> ServerResult> { - Ok(self - .db() - .await - .exec( - QueryBuilder::select() - .values(["username", "token"]) - .ids( - QueryBuilder::search() - .from("users") - .where_() - .distance(CountComparison::Equal(2)) - .query(), - ) - .query(), - )? - .elements + pub(crate) async fn find_user_dbs(&self, user: DbId) -> ServerResult> { + let user_dbs = self.0.server_db.user_dbs(user).await?; + let mut dbs: Vec = user_dbs .into_iter() - .map(|e| UserStatus { - name: e.values[0].value.to_string(), - login: !e.values[1].value.to_string().is_empty(), - admin: false, + .map(|(role, db)| ServerDatabase { + name: db.name, + db_type: db.db_type, + role, + size: 0, + backup: db.backup, }) - .collect()) - } - - pub(crate) async fn find_user_dbs(&self, user: DbId) -> ServerResult> { - let mut dbs = vec![]; + .collect(); - let elements = self - .db() - .await - .exec( - QueryBuilder::select() - .ids( - QueryBuilder::search() - .depth_first() - .from(user) - .where_() - .distance(CountComparison::Equal(1)) - .or() - .distance(CountComparison::Equal(2)) - .query(), - ) - .query(), - )? - .elements; - - for e in elements { - if e.id.0 < 0 { - dbs.push(ServerDatabase { - role: (&e.values[0].value).into(), - ..Default::default() - }); - } else { - let db = Database::from_db_element(&e)?; - let server_db = dbs.last_mut().unwrap(); - server_db.db_type = db.db_type; - server_db.backup = db.backup; - server_db.size = self - .get_pool() - .await - .get(&db.name) - .ok_or(db_not_found(&db.name))? - .size() - .await; - server_db.name = db.name; - } + for db in dbs.iter_mut() { + db.size = self + .get_pool() + .await + .get(&db.name) + .ok_or(db_not_found(&db.name))? + .size() + .await; } Ok(dbs) } - pub(crate) async fn find_user(&self, name: &str) -> ServerResult { - let user_id = self.find_user_id(name).await?; - Ok(self - .db() - .await - .exec( - QueryBuilder::select() - .elements::() - .ids(user_id) - .query(), - )? - .try_into()?) - } - - pub(crate) async fn find_user_id(&self, name: &str) -> ServerResult { - Ok(self - .db() - .await - .exec(QueryBuilder::search().index("username").value(name).query())? - .elements - .first() - .ok_or(user_not_found(name))? - .id) - } - - pub(crate) async fn find_user_id_by_token(&self, token: &str) -> ServerResult { - Ok(self - .db() - .await - .exec(QueryBuilder::search().index("token").value(token).query())? - .elements - .first() - .ok_or(format!("No user found for token '{token}'"))? - .id) - } - - pub(crate) async fn get_user(&self, user: DbId) -> ServerResult { - Ok(self - .db() - .await - .exec( - QueryBuilder::select() - .elements::() - .ids(user) - .query(), - )? - .try_into()?) - } - pub(crate) async fn db_users( &self, owner: &str, db: &str, user: DbId, ) -> ServerResult> { - let db_id = self.find_user_db_id(user, &db_name(owner, db)).await?; - let mut users = vec![]; - - self.db() - .await - .exec( - QueryBuilder::select() - .ids( - QueryBuilder::search() - .depth_first() - .to(db_id) - .where_() - .distance(CountComparison::LessThanOrEqual(2)) - .and() - .where_() - .keys("role") - .or() - .keys("password") - .query(), - ) - .query(), - )? - .elements - .into_iter() - .for_each(|e| { - if e.id.0 < 0 { - users.push(DbUser { - user: String::new(), - role: (&e.values[0].value).into(), - }); - } else { - users.last_mut().unwrap().user = e.values[0].value.to_string(); - } - }); - - Ok(users) + let db = db_name(owner, db); + let db_id = self.0.server_db.user_db_id(user, &db).await?; + self.0.server_db.db_users(db_id).await } pub(crate) async fn optimize_db( @@ -858,8 +650,8 @@ impl DbPool { user: DbId, ) -> ServerResult { let db_name = db_name(owner, db); - let db = self.find_user_db(user, &db_name).await?; - let role = self.find_user_db_role(user, &db_name).await?; + let db = self.0.server_db.user_db(user, &db_name).await?; + let role = self.0.server_db.user_db_role(user, &db_name).await?; if role == DbUserRole::Read { return Err(permission_denied("write rights required")); @@ -890,27 +682,18 @@ impl DbPool { return Err(permission_denied("cannot remove owner")); } - let db_id = self.find_user_db_id(user, &db_name(owner, db)).await?; - let user_id = self.find_db_user_id(db_id, username).await?; + let db_id = self + .0 + .server_db + .user_db_id(user, &db_name(owner, db)) + .await?; + let user_id = self.0.server_db.user_id(username).await?; - if user != user_id && !self.is_db_admin(user, db_id).await? { + if user != user_id && !self.0.server_db.is_db_admin(user, db_id).await? { return Err(permission_denied("admin only")); } - self.db_mut().await.exec_mut( - QueryBuilder::remove() - .ids( - QueryBuilder::search() - .from(user_id) - .to(db_id) - .limit(1) - .where_() - .keys("role") - .query(), - ) - .query(), - )?; - Ok(()) + self.0.server_db.remove_db_user(db_id, user).await } pub(crate) async fn remove_db( @@ -919,36 +702,22 @@ impl DbPool { db: &str, user: DbId, ) -> ServerResult { - let user_name = self.user_name(user).await?; + let user_name = self.0.server_db.user_name(user).await?; if owner != user_name { return Err(permission_denied("owner only")); } + self.0.server_db.remove_db(user, db).await?; let db_name = db_name(owner, db); - let db_id = self.find_user_db_id(user, &db_name).await?; - - self.db_mut() - .await - .exec_mut(QueryBuilder::remove().ids(db_id).query())?; - Ok(self.get_pool_mut().await.remove(&db_name).unwrap()) } pub(crate) async fn remove_user(&self, username: &str, config: &Config) -> ServerResult { - let user_id = self.find_user_id(username).await?; - let dbs = self.find_user_databases(user_id).await?; - let mut ids = dbs - .iter() - .map(|db| db.db_id.unwrap()) - .collect::>(); - ids.push(user_id); - self.db_mut() - .await - .exec_mut(QueryBuilder::remove().ids(ids).query())?; + let db_names = self.0.server_db.remove_user(username).await?; - for db in dbs.into_iter() { - self.get_pool_mut().await.remove(&db.name); + for db in db_names.into_iter() { + self.get_pool_mut().await.remove(&db); } let user_dir = Path::new(&config.data_dir).join(username); @@ -974,13 +743,13 @@ impl DbPool { } let (new_owner, new_db) = new_name.split_once('/').ok_or(ErrorCode::DbInvalid)?; - let username = self.user_name(user).await?; + let username = self.0.server_db.user_name(user).await?; if owner != username { return Err(permission_denied("owner only")); } - let mut database = self.find_user_db(user, &db_name).await?; + let mut database = self.0.server_db.user_db(user, &db_name).await?; let target_name = db_file(new_owner, new_db, config); if target_name.exists() { @@ -1023,9 +792,7 @@ impl DbPool { .insert(new_name.to_string(), server_db); database.name = new_name.to_string(); - self.db_mut() - .await - .exec_mut(QueryBuilder::insert().element(&database).query())?; + self.0.server_db.save_db(&database).await?; self.get_pool_mut().await.remove(&db_name).unwrap(); @@ -1040,9 +807,14 @@ impl DbPool { config: &Config, ) -> ServerResult { let db_name = db_name(owner, db); - let mut database = self.find_user_db(user, &db_name).await?; + let mut database = self.0.server_db.user_db(user, &db_name).await?; - if !self.is_db_admin(user, database.db_id.unwrap()).await? { + if !self + .0 + .server_db + .is_db_admin(user, database.db_id.unwrap()) + .await? + { return Err(permission_denied("admin only")); } @@ -1077,235 +849,33 @@ impl DbPool { current_path.to_string_lossy() ))?; pool.insert(db_name, server_db); - self.save_db(&database).await?; + self.0.server_db.save_db(&database).await?; Ok(()) } pub(crate) async fn user_token(&self, user: DbId) -> ServerResult { - self.db_mut().await.transaction_mut(|t| { - let mut user_token = t - .exec(QueryBuilder::select().values("token").ids(user).query())? - .elements[0] - .values[0] - .value - .to_string(); - - if user_token.is_empty() { - let token_uuid = Uuid::new_v4(); - user_token = token_uuid.to_string(); - t.exec_mut( - QueryBuilder::insert() - .values_uniform([("token", &user_token.clone()).into()]) - .ids(user) - .query(), - )?; - } + let mut user_token = self.0.server_db.user_token(user).await?; - Ok(user_token) - }) - } + if user_token.is_empty() { + let token_uuid = Uuid::new_v4(); + user_token = token_uuid.to_string(); + self.0.server_db.save_token(user, &user_token).await?; + } - pub(crate) async fn save_user(&self, user: ServerUser) -> ServerResult { - self.db_mut() - .await - .exec_mut(QueryBuilder::insert().element(&user).query())?; - Ok(()) + Ok(user_token) } pub(crate) async fn status(&self, config: &Config) -> ServerResult { - let indexes = self - .db() - .await - .exec(QueryBuilder::select().indexes().query())?; - tracing::info!("{:?}", indexes); - Ok(AdminStatus { uptime: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() - config.start_time, - dbs: self - .db() - .await - .exec(QueryBuilder::select().edge_count_from().ids("dbs").query())? - .elements[0] - .values[0] - .value - .to_u64()?, - users: self - .db() - .await - .exec( - QueryBuilder::select() - .edge_count_from() - .ids("users") - .query(), - )? - .elements[0] - .values[0] - .value - .to_u64()?, - logged_in_users: self.db().await.transaction(|t| -> ServerResult { - let empty_tokens = if t - .exec(QueryBuilder::search().index("token").value("").query())? - .result - == 0 - { - 0 - } else { - 1 - }; - let tokens = t.exec(QueryBuilder::select().indexes().query())?.elements[0].values - [1] - .value - .to_u64()?; - Ok(tokens - empty_tokens) - })?, + dbs: self.0.server_db.db_count().await?, + users: self.0.server_db.user_count().await?, + logged_in_users: self.0.server_db.user_token_count().await?, size: get_size(&config.data_dir).await?, }) } - pub(crate) async fn user_name(&self, id: DbId) -> ServerResult { - Ok(self - .db() - .await - .exec(QueryBuilder::select().values("username").ids(id).query())? - .elements[0] - .values[0] - .value - .to_string()) - } - - async fn db(&self) -> RwLockReadGuard { - self.0.server_db.get().await - } - - async fn db_mut(&self) -> RwLockWriteGuard { - self.0.server_db.get_mut().await - } - - async fn find_db_user_id(&self, db: DbId, name: &str) -> ServerResult { - Ok(self - .db() - .await - .exec( - QueryBuilder::search() - .depth_first() - .to(db) - .where_() - .distance(CountComparison::Equal(2)) - .and() - .key("username") - .value(Comparison::Equal(name.into())) - .query(), - )? - .elements - .first() - .ok_or(user_not_found(name))? - .id) - } - - fn find_user_db_id_query(&self, user: DbId, db: &str) -> SearchQuery { - QueryBuilder::search() - .depth_first() - .from(user) - .limit(1) - .where_() - .distance(CountComparison::Equal(2)) - .and() - .key("name") - .value(Comparison::Equal(db.into())) - .query() - } - - async fn find_user_db(&self, user: DbId, db: &str) -> ServerResult { - let db_id_query = self.find_user_db_id_query(user, db); - Ok(self - .db() - .await - .transaction(|t| -> Result { - let db_id = t - .exec(db_id_query)? - .elements - .first() - .ok_or(db_not_found(db))? - .id; - Ok(t.exec( - QueryBuilder::select() - .elements::() - .ids(db_id) - .query(), - )?) - })? - .try_into()?) - } - - async fn find_user_databases(&self, user: DbId) -> ServerResult> { - Ok(self - .db() - .await - .exec( - QueryBuilder::select() - .elements::() - .ids( - QueryBuilder::search() - .depth_first() - .from(user) - .where_() - .distance(CountComparison::Equal(2)) - .query(), - ) - .query(), - )? - .try_into()?) - } - - async fn find_user_db_id(&self, user: DbId, db: &str) -> ServerResult { - let db_id_query = self.find_user_db_id_query(user, db); - Ok(self - .db() - .await - .exec(db_id_query)? - .elements - .first() - .ok_or(db_not_found(db))? - .id) - } - - async fn find_user_db_role(&self, user: DbId, db: &str) -> ServerResult { - let db_id_query = self.find_user_db_id_query(user, db); - Ok((&self - .db() - .await - .transaction(|t| -> Result { - let db_id = t - .exec(db_id_query)? - .elements - .first() - .ok_or(db_not_found(db))? - .id; - - Ok(t.exec( - QueryBuilder::select() - .ids( - QueryBuilder::search() - .depth_first() - .from(user) - .to(db_id) - .limit(1) - .where_() - .distance(CountComparison::LessThanOrEqual(2)) - .and() - .keys("role") - .query(), - ) - .query(), - )?) - })? - .elements[0] - .values[0] - .value) - .into()) - } - async fn get_pool(&self) -> RwLockReadGuard> { self.0.pool.read().await } @@ -1313,33 +883,6 @@ impl DbPool { async fn get_pool_mut(&self) -> RwLockWriteGuard> { self.0.pool.write().await } - - async fn is_db_admin(&self, user: DbId, db: DbId) -> ServerResult { - Ok(self - .db() - .await - .exec( - QueryBuilder::search() - .from(user) - .to(db) - .limit(1) - .where_() - .distance(CountComparison::LessThanOrEqual(2)) - .and() - .key("role") - .value(Comparison::Equal(DbUserRole::Admin.into())) - .query(), - )? - .result - == 1) - } - - async fn save_db(&self, db: &Database) -> ServerResult { - self.db_mut() - .await - .exec_mut(QueryBuilder::insert().element(db).query())?; - Ok(()) - } } fn do_clear_db_audit(owner: &str, db: &str, config: &Config) -> Result<(), ServerError> { @@ -1352,10 +895,6 @@ fn do_clear_db_audit(owner: &str, db: &str, config: &Config) -> Result<(), Serve Ok(()) } -fn user_not_found(name: &str) -> ServerError { - ServerError::new(StatusCode::NOT_FOUND, &format!("user not found: {name}")) -} - fn db_not_found(name: &str) -> ServerError { ServerError::new(StatusCode::NOT_FOUND, &format!("db not found: {name}")) } diff --git a/agdb_server/src/db_pool/server_db.rs b/agdb_server/src/db_pool/server_db.rs deleted file mode 100644 index 7884ee2f..00000000 --- a/agdb_server/src/db_pool/server_db.rs +++ /dev/null @@ -1,95 +0,0 @@ -use crate::db_pool::user_db_storage::UserDbStorage; -use crate::db_pool::Database; -use crate::db_pool::ServerUser; -use crate::server_error::ServerResult; -use agdb::CountComparison; -use agdb::DbId; -use agdb::DbImpl; -use agdb::QueryBuilder; -use std::sync::Arc; -use tokio::sync::RwLock; -use tokio::sync::RwLockReadGuard; -use tokio::sync::RwLockWriteGuard; - -pub(crate) type ServerDbImpl = DbImpl; -pub(crate) struct ServerDb(pub(crate) Arc>); - -const DBS: &str = "dbs"; -const USERS: &str = "users"; -const USERNAME: &str = "username"; -const TOKEN: &str = "token"; - -impl ServerDb { - pub(crate) async fn get(&self) -> RwLockReadGuard { - self.0.read().await - } - - pub(crate) async fn get_mut(&self) -> RwLockWriteGuard { - self.0.write().await - } - - pub(crate) fn load(name: &str) -> ServerResult { - Ok(Self(Arc::new(RwLock::new(ServerDbImpl::new(name)?)))) - } - - pub(crate) fn new(name: &str, admin: ServerUser) -> ServerResult { - let mut db = ServerDbImpl::new(name)?; - - db.transaction_mut(|t| { - t.exec_mut(QueryBuilder::insert().index(USERNAME).query())?; - t.exec_mut(QueryBuilder::insert().index(TOKEN).query())?; - t.exec_mut(QueryBuilder::insert().nodes().aliases([USERS, DBS]).query())?; - let id = t - .exec_mut(QueryBuilder::insert().element(&admin).query())? - .elements[0] - .id; - t.exec_mut(QueryBuilder::insert().edges().from(USERS).to(id).query()) - })?; - - Ok(Self(Arc::new(RwLock::new(db)))) - } - - pub(crate) async fn find_user_id(&self, username: &str) -> ServerResult> { - Ok(self - .0 - .read() - .await - .exec( - QueryBuilder::search() - .index(USERNAME) - .value(username) - .query(), - )? - .elements - .first() - .map(|e| e.id)) - } - - pub(crate) async fn insert_user(&self, user: ServerUser) -> ServerResult { - self.0.write().await.transaction_mut(|t| { - let id = t - .exec_mut(QueryBuilder::insert().element(&user).query())? - .elements[0] - .id; - t.exec_mut(QueryBuilder::insert().edges().from(USERS).to(id).query())?; - Ok(id) - }) - } - - pub(crate) async fn dbs(&self) -> ServerResult> { - Ok(self - .0 - .read() - .await - .exec( - QueryBuilder::select() - .elements::() - .search() - .from(DBS) - .where_() - .distance(CountComparison::Equal(2)) - .query(), - )? - .try_into()?) - } -} diff --git a/agdb_server/src/main.rs b/agdb_server/src/main.rs index 617c6dd7..b9ab79a2 100644 --- a/agdb_server/src/main.rs +++ b/agdb_server/src/main.rs @@ -7,6 +7,7 @@ mod error_code; mod logger; mod password; mod routes; +mod server_db; mod server_error; mod server_state; mod user_id; diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs new file mode 100644 index 00000000..817b378d --- /dev/null +++ b/agdb_server/src/server_db.rs @@ -0,0 +1,563 @@ +use crate::server_error::ServerError; +use crate::server_error::ServerResult; +use agdb::Comparison; +use agdb::CountComparison; +use agdb::Db; +use agdb::DbId; +use agdb::DbUserValue; +use agdb::QueryBuilder; +use agdb::QueryId; +use agdb::QueryResult; +use agdb::SearchQuery; +use agdb::UserValue; +use agdb_api::DbType; +use agdb_api::DbUser; +use agdb_api::DbUserRole; +use agdb_api::UserStatus; +use reqwest::StatusCode; +use std::sync::Arc; +use tokio::sync::RwLock; + +#[derive(UserValue)] +pub(crate) struct ServerUser { + pub(crate) db_id: Option, + pub(crate) username: String, + pub(crate) password: Vec, + pub(crate) salt: Vec, + pub(crate) token: String, +} + +#[derive(Default, UserValue)] +struct Database { + pub(crate) db_id: Option, + pub(crate) name: String, + pub(crate) db_type: DbType, + pub(crate) backup: u64, +} + +#[derive(Clone)] +pub(crate) struct ServerDb(pub(crate) Arc>); + +const DBS: &str = "dbs"; +const NAME: &str = "name"; +const ROLE: &str = "role"; +const TOKEN: &str = "token"; +const USERS: &str = "users"; +const USERNAME: &str = "username"; + +impl ServerDb { + pub(crate) fn load(name: &str) -> ServerResult { + Ok(Self(Arc::new(RwLock::new(Db::new(name)?)))) + } + + pub(crate) fn new(name: &str, admin: ServerUser) -> ServerResult { + let mut db = Db::new(name)?; + + db.transaction_mut(|t| { + t.exec_mut(QueryBuilder::insert().index(USERNAME).query())?; + t.exec_mut(QueryBuilder::insert().index(TOKEN).query())?; + t.exec_mut(QueryBuilder::insert().nodes().aliases([USERS, DBS]).query())?; + let id = t + .exec_mut(QueryBuilder::insert().element(&admin).query())? + .elements[0] + .id; + t.exec_mut(QueryBuilder::insert().edges().from(USERS).to(id).query()) + })?; + + Ok(Self(Arc::new(RwLock::new(db)))) + } + + pub(crate) async fn db_count(&self) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec(QueryBuilder::select().edge_count_from().ids(DBS).query())? + .elements[0] + .values[0] + .value + .to_u64()?) + } + + pub(crate) async fn db_users(&self, db: DbId) -> ServerResult> { + let mut users = vec![]; + + self.0 + .read() + .await + .exec( + QueryBuilder::select() + .search() + .depth_first() + .to(db) + .where_() + .distance(CountComparison::LessThanOrEqual(2)) + .and() + .where_() + .keys("role") + .or() + .keys("password") + .query(), + )? + .elements + .into_iter() + .for_each(|e| { + if e.id.0 < 0 { + users.push(DbUser { + user: String::new(), + role: (&e.values[0].value).into(), + }); + } else { + users.last_mut().unwrap().user = e.values[0].value.to_string(); + } + }); + + Ok(users) + } + + pub(crate) async fn dbs(&self) -> ServerResult> { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::select() + .elements::() + .search() + .from(DBS) + .where_() + .distance(CountComparison::Equal(2)) + .query(), + )? + .try_into()?) + } + + pub(crate) async fn find_user_db_id(&self, user: DbId, db: &str) -> ServerResult> { + Ok(self + .0 + .read() + .await + .exec(find_user_db_query(user, db))? + .elements + .first() + .map(|e| e.id)) + } + + pub(crate) async fn find_user_id(&self, username: &str) -> ServerResult> { + Ok(self + .0 + .read() + .await + .exec(find_user_query(username))? + .elements + .first() + .map(|e| e.id)) + } + + pub(crate) async fn insert_db(&self, owner: DbId, db: Database) -> ServerResult { + self.0.write().await.transaction_mut(|t| { + let id = t + .exec_mut(QueryBuilder::insert().element(&db).query())? + .elements[0] + .id; + t.exec_mut( + QueryBuilder::insert() + .edges() + .from([QueryId::from(owner), DBS.into()]) + .to(id) + .values([vec![(ROLE, DbUserRole::Admin).into()], vec![]]) + .query(), + )?; + Ok(id) + }) + } + + pub(crate) async fn insert_db_user( + &self, + db: DbId, + user: DbId, + role: DbUserRole, + ) -> ServerResult<()> { + self.0.write().await.transaction_mut(|t| { + let existing_role = t.exec( + QueryBuilder::search() + .from(user) + .to(db) + .limit(1) + .where_() + .keys(ROLE) + .query(), + )?; + + if existing_role.result == 1 { + t.exec_mut( + QueryBuilder::insert() + .values([[(ROLE, role).into()]]) + .ids(existing_role) + .query(), + )?; + } else { + t.exec_mut( + QueryBuilder::insert() + .edges() + .from(user) + .to(db) + .values_uniform([(ROLE, role).into()]) + .query(), + )?; + } + Ok(()) + }) + } + + pub(crate) async fn insert_user(&self, user: ServerUser) -> ServerResult { + self.0.write().await.transaction_mut(|t| { + let id = t + .exec_mut(QueryBuilder::insert().element(&user).query())? + .elements[0] + .id; + t.exec_mut(QueryBuilder::insert().edges().from(USERS).to(id).query())?; + Ok(id) + }) + } + + pub(crate) async fn is_db_admin(&self, user: DbId, db: DbId) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::search() + .from(user) + .to(db) + .limit(1) + .where_() + .distance(CountComparison::Equal(2)) + .and() + .key(ROLE) + .value(Comparison::Equal(DbUserRole::Admin.into())) + .query(), + )? + .result + == 1) + } + + pub(crate) async fn remove_db(&self, user: DbId, db: &str) -> ServerResult<()> { + self.0.write().await.exec_mut( + QueryBuilder::remove() + .ids(find_user_db_query(user, db)) + .query(), + )?; + Ok(()) + } + + pub(crate) async fn remove_db_user(&self, db: DbId, user: DbId) -> ServerResult<()> { + self.0.write().await.exec_mut( + QueryBuilder::remove() + .search() + .from(user) + .to(db) + .limit(1) + .where_() + .keys("role") + .query(), + )?; + Ok(()) + } + + pub(crate) async fn remove_user(&self, username: &str) -> ServerResult> { + let user = self.user_id(username).await?; + let mut ids = vec![user]; + let mut dbs = vec![]; + + self.user_dbs(user) + .await? + .into_iter() + .for_each(|(_role, db)| { + if let Some((owner, _)) = db.name.split_once('/') { + if owner == username { + ids.push(db.db_id.unwrap()); + dbs.push(db.name); + } + } + }); + + self.0 + .write() + .await + .exec_mut(QueryBuilder::remove().ids(ids).query())?; + + Ok(dbs) + } + + pub(crate) async fn save_db(&self, db: &Database) -> ServerResult<()> { + self.0 + .write() + .await + .exec_mut(QueryBuilder::insert().element(db).query())?; + Ok(()) + } + + pub(crate) async fn save_token(&self, user: DbId, token: &str) -> ServerResult<()> { + self.0.write().await.exec_mut( + QueryBuilder::insert() + .values([[(TOKEN, token).into()]]) + .ids(user) + .query(), + )?; + Ok(()) + } + + pub(crate) async fn save_user(&self, user: ServerUser) -> ServerResult<()> { + self.0 + .write() + .await + .exec_mut(QueryBuilder::insert().element(&user).query())?; + Ok(()) + } + + pub(crate) async fn user(&self, username: &str) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::select() + .elements::() + .ids(find_user_query(username)) + .query(), + )? + .try_into() + .map_err(|_| user_not_found(username))?) + } + + pub(crate) async fn user_name(&self, id: DbId) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec(QueryBuilder::select().values(USERNAME).ids(id).query())? + .elements[0] + .values[0] + .value + .to_string()) + } + + pub(crate) async fn user_by_id(&self, id: DbId) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::select() + .elements::() + .ids(id) + .query(), + )? + .try_into()?) + } + + pub(crate) async fn user_db(&self, user: DbId, db: &str) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::select() + .elements::() + .ids(find_user_db_query(user, db)) + .query(), + )? + .try_into() + .map_err(|_| db_not_found(db))?) + } + + pub(crate) async fn user_db_id(&self, user: DbId, db: &str) -> ServerResult { + Ok(self + .find_user_db_id(user, db) + .await? + .ok_or(db_not_found(db))?) + } + + pub(crate) async fn user_db_role(&self, user: DbId, db: &str) -> ServerResult { + Ok((&self + .0 + .read() + .await + .transaction(|t| -> Result { + let db_id = t + .exec(find_user_db_query(user, db))? + .elements + .first() + .ok_or(db_not_found(db))? + .id; + Ok(t.exec( + QueryBuilder::select() + .search() + .depth_first() + .from(user) + .to(db_id) + .limit(1) + .where_() + .distance(CountComparison::LessThanOrEqual(2)) + .and() + .keys("role") + .query(), + )?) + })? + .elements[0] + .values[0] + .value) + .into()) + } + + pub(crate) async fn user_dbs(&self, user: DbId) -> ServerResult> { + let mut dbs = vec![]; + + let elements = self + .0 + .read() + .await + .exec( + QueryBuilder::select() + .ids( + QueryBuilder::search() + .depth_first() + .from(user) + .where_() + .distance(CountComparison::Equal(1)) + .or() + .distance(CountComparison::Equal(2)) + .query(), + ) + .query(), + )? + .elements; + + for e in elements { + if e.id.0 < 0 { + dbs.push(((&e.values[0].value).into(), Database::default())); + } else { + dbs.last_mut().unwrap().1 = Database::from_db_element(&e)?; + } + } + + Ok(dbs) + } + + pub(crate) async fn user_count(&self) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec(QueryBuilder::select().edge_count_from().ids(USERS).query())? + .elements[0] + .values[0] + .value + .to_u64()?) + } + + pub(crate) async fn user_id(&self, username: &str) -> ServerResult { + self.find_user_id(username) + .await? + .ok_or(user_not_found(username)) + } + + pub(crate) async fn user_token(&self, user: DbId) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec(QueryBuilder::select().values(TOKEN).ids(user).query())? + .elements[0] + .values[0] + .value + .to_string()) + } + + pub(crate) async fn user_token_count(&self) -> ServerResult { + self.0.read().await.transaction(|t| -> ServerResult { + let empty_tokens = if t + .exec(QueryBuilder::search().index("token").value("").query())? + .result + == 0 + { + 0 + } else { + 1 + }; + let tokens = t.exec(QueryBuilder::select().indexes().query())?.elements[0].values[1] + .value + .to_u64()?; + Ok(tokens - empty_tokens) + }) + } + + pub(crate) async fn user_token_id(&self, token: &str) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec(QueryBuilder::search().index(TOKEN).value(token).query())? + .elements + .first() + .ok_or(token_not_found(token))? + .id) + } + + pub(crate) async fn user_statuses(&self) -> ServerResult> { + Ok(self + .0 + .read() + .await + .exec( + QueryBuilder::select() + .values([USERNAME, TOKEN]) + .search() + .from(USERS) + .where_() + .distance(CountComparison::Equal(2)) + .query(), + )? + .elements + .into_iter() + .map(|e| UserStatus { + name: e.values[0].value.to_string(), + login: !e.values[1].value.to_string().is_empty(), + admin: false, + }) + .collect()) + } +} + +fn db_not_found(name: &str) -> ServerError { + ServerError::new(StatusCode::NOT_FOUND, &format!("db not found: {name}")) +} + +fn find_user_db_query(user: DbId, db: &str) -> SearchQuery { + QueryBuilder::search() + .depth_first() + .from(user) + .limit(1) + .where_() + .distance(CountComparison::Equal(2)) + .and() + .key(NAME) + .value(Comparison::Equal(db.into())) + .query() +} + +fn find_user_query(username: &str) -> SearchQuery { + QueryBuilder::search() + .index(USERNAME) + .value(username) + .query() +} + +fn token_not_found(token: &str) -> ServerError { + ServerError::new(StatusCode::NOT_FOUND, &format!("token not found: {token}")) +} + +fn user_not_found(name: &str) -> ServerError { + ServerError::new(StatusCode::NOT_FOUND, &format!("user not found: {name}")) +} diff --git a/agdb_server/src/server_state.rs b/agdb_server/src/server_state.rs index 3405886c..5a17a67a 100644 --- a/agdb_server/src/server_state.rs +++ b/agdb_server/src/server_state.rs @@ -1,6 +1,7 @@ use crate::cluster::Cluster; use crate::config::Config; use crate::db_pool::DbPool; +use crate::server_db::ServerDb; use axum::extract::FromRef; use tokio::sync::broadcast::Sender; @@ -9,6 +10,7 @@ pub(crate) struct ServerState { pub(crate) db_pool: DbPool, pub(crate) config: Config, pub(crate) cluster: Cluster, + pub(crate) server_db: ServerDb, pub(crate) shutdown_sender: Sender<()>, } @@ -18,9 +20,9 @@ impl FromRef for DbPool { } } -impl FromRef for Sender<()> { +impl FromRef for Cluster { fn from_ref(input: &ServerState) -> Self { - input.shutdown_sender.clone() + input.cluster.clone() } } @@ -30,8 +32,14 @@ impl FromRef for Config { } } -impl FromRef for Cluster { +impl FromRef for Sender<()> { fn from_ref(input: &ServerState) -> Self { - input.cluster.clone() + input.shutdown_sender.clone() + } +} + +impl FromRef for ServerDb { + fn from_ref(input: &ServerState) -> Self { + input.server_db.clone() } } diff --git a/agdb_server/src/user_id.rs b/agdb_server/src/user_id.rs index 3814f144..d67de1b7 100644 --- a/agdb_server/src/user_id.rs +++ b/agdb_server/src/user_id.rs @@ -1,5 +1,6 @@ use crate::config::Config; use crate::db_pool::DbPool; +use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::utilities; use agdb::DbId; @@ -26,15 +27,15 @@ pub(crate) struct UserName(pub(crate) String); impl FromRequestParts for UserName where S: Send + Sync, - DbPool: FromRef, + ServerDb: FromRef, { type Rejection = ServerError; async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { if let Ok(bearer) = parts.extract::>>().await { - let db_pool = DbPool::from_ref(state); + let db_pool = ServerDb::from_ref(state); let id = db_pool - .find_user_id_by_token(utilities::unquote(bearer.token())) + .user_token_id(utilities::unquote(bearer.token())) .await?; return Ok(UserName(db_pool.user_name(id).await?)); } @@ -47,15 +48,15 @@ where impl FromRequestParts for UserId where S: Send + Sync, - DbPool: FromRef, + ServerDb: FromRef, { type Rejection = StatusCode; async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { let bearer: TypedHeader> = parts.extract().await.map_err(unauthorized)?; - let id = DbPool::from_ref(state) - .find_user_id_by_token(utilities::unquote(bearer.token())) + let id = ServerDb::from_ref(state) + .user_token_id(utilities::unquote(bearer.token())) .await .map_err(unauthorized)?; Ok(Self(id)) @@ -66,15 +67,15 @@ where impl FromRequestParts for AdminId where S: Send + Sync, - DbPool: FromRef, + ServerDb: FromRef, Config: FromRef, { type Rejection = StatusCode; async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { - let admin_user = Config::from_ref(state).admin.clone(); - let admin = DbPool::from_ref(state) - .find_user(&admin_user) + let admin_user = &Config::from_ref(state).admin; + let admin = ServerDb::from_ref(state) + .user_token(admin_user.as_str()) .await .map_err(unauthorized)?; let bearer: TypedHeader> = From 2883d4916939bd2536a8df6e077cfbc17e44f609 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 20:33:16 +0100 Subject: [PATCH 03/28] wip --- agdb_server/src/app.rs | 11 +++-- agdb_server/src/db_pool.rs | 85 +++++---------------------------- agdb_server/src/main.rs | 9 ++-- agdb_server/src/routes/admin.rs | 5 +- agdb_server/src/routes/user.rs | 35 +++++++++----- agdb_server/src/server_db.rs | 83 ++++++++++++++++++++++++++------ agdb_server/src/user_id.rs | 17 +++---- 7 files changed, 125 insertions(+), 120 deletions(-) diff --git a/agdb_server/src/app.rs b/agdb_server/src/app.rs index 35a0f768..1c0a7432 100644 --- a/agdb_server/src/app.rs +++ b/agdb_server/src/app.rs @@ -4,6 +4,7 @@ use crate::config::Config; use crate::db_pool::DbPool; use crate::logger; use crate::routes; +use crate::server_db::ServerDb; use crate::server_state::ServerState; use axum::middleware; use axum::routing; @@ -15,17 +16,19 @@ use utoipa::OpenApi; use utoipa_rapidoc::RapiDoc; pub(crate) fn app( + cluster: Cluster, config: Config, - shutdown_sender: Sender<()>, db_pool: DbPool, - cluster: Cluster, + server_db: ServerDb, + shutdown_sender: Sender<()>, ) -> Router { let basepath = config.basepath.clone(); let state = ServerState { - db_pool, - config, cluster, + config, + db_pool, + server_db, shutdown_sender, }; diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index a55c4d68..c5e64949 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -36,74 +36,23 @@ use tokio::sync::RwLockWriteGuard; use user_db::UserDb; use uuid::Uuid; -pub(crate) struct DbPoolImpl { - server_db: ServerDb, - pool: RwLock>, -} - #[derive(Clone)] -pub(crate) struct DbPool(pub(crate) Arc); +pub(crate) struct DbPool(pub(crate) Arc>>); impl DbPool { - pub(crate) async fn new(config: &Config) -> ServerResult { + pub(crate) async fn new(config: &Config, server_db: &ServerDb) -> ServerResult { std::fs::create_dir_all(&config.data_dir)?; - let db_exists = Path::new(&config.data_dir) - .join("agdb_server.agdb") - .exists(); - - Ok(if db_exists { - let db_pool = Self(Arc::new(DbPoolImpl { - server_db: ServerDb::load(&format!("mapped:{}/agdb_server.agdb", config.data_dir))?, - pool: RwLock::new(HashMap::new()), - })); + let db_pool = Self(Arc::new(RwLock::new(HashMap::new()))); - if db_pool - .0 - .server_db - .find_user_id(&config.admin) - .await - .is_ok() - { - let admin_password = Password::create(&config.admin, &config.admin); - db_pool - .0 - .server_db - .insert_user(ServerUser { - db_id: None, - username: config.admin.clone(), - password: admin_password.password.to_vec(), - salt: admin_password.user_salt.to_vec(), - token: String::new(), - }) - .await?; - } - - for db in db_pool.0.server_db.dbs().await? { - let (owner, db_name) = db.name.split_once('/').ok_or(ErrorCode::DbInvalid)?; - let db_path = db_file(owner, db_name, config); - std::fs::create_dir_all(db_audit_dir(owner, config))?; - let server_db = - UserDb::new(&format!("{}:{}", db.db_type, db_path.to_string_lossy()))?; - db_pool.0.pool.write().await.insert(db.name, server_db); - } + for db in server_db.dbs().await? { + let (owner, db_name) = db.name.split_once('/').ok_or(ErrorCode::DbInvalid)?; + let db_path = db_file(owner, db_name, config); + std::fs::create_dir_all(db_audit_dir(owner, config))?; + let server_db = UserDb::new(&format!("{}:{}", db.db_type, db_path.to_string_lossy()))?; + db_pool.0.write().await.insert(db.name, server_db); + } - db_pool - } else { - let admin_password = Password::create(&config.admin, &config.admin); - Self(Arc::new(DbPoolImpl { - server_db: ServerDb::new( - &format!("mapped:{}/agdb_server.agdb", config.data_dir), - ServerUser { - db_id: None, - username: config.admin.clone(), - password: admin_password.password.to_vec(), - salt: admin_password.user_salt.to_vec(), - token: String::new(), - }, - )?, - pool: RwLock::new(HashMap::new()), - })) - }) + db_pool } pub(crate) async fn add_db( @@ -854,18 +803,6 @@ impl DbPool { Ok(()) } - pub(crate) async fn user_token(&self, user: DbId) -> ServerResult { - let mut user_token = self.0.server_db.user_token(user).await?; - - if user_token.is_empty() { - let token_uuid = Uuid::new_v4(); - user_token = token_uuid.to_string(); - self.0.server_db.save_token(user, &user_token).await?; - } - - Ok(user_token) - } - pub(crate) async fn status(&self, config: &Config) -> ServerResult { Ok(AdminStatus { uptime: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() - config.start_time, diff --git a/agdb_server/src/main.rs b/agdb_server/src/main.rs index b9ab79a2..6dd7c677 100644 --- a/agdb_server/src/main.rs +++ b/agdb_server/src/main.rs @@ -26,12 +26,15 @@ async fn main() -> ServerResult { let (shutdown_sender, shutdown_receiver) = broadcast::channel::<()>(1); let cluster = cluster::new(&config)?; - let db_pool = DbPool::new(&config).await?; + let server_db = server_db::new(&config).await?; + let db_pool = DbPool::new(&config, &server_db).await?; + let app = app::app( + cluster.clone(), config.clone(), - shutdown_sender.clone(), db_pool, - cluster.clone(), + server_db, + shutdown_sender.clone(), ); tracing::info!("Listening at {}", config.bind); let listener = tokio::net::TcpListener::bind(&config.bind).await?; diff --git a/agdb_server/src/routes/admin.rs b/agdb_server/src/routes/admin.rs index 2297e528..4049b23f 100644 --- a/agdb_server/src/routes/admin.rs +++ b/agdb_server/src/routes/admin.rs @@ -54,13 +54,12 @@ pub(crate) async fn status( #[cfg(test)] mod tests { use super::*; - use agdb::DbId; #[tokio::test] async fn shutdown_test() -> anyhow::Result<()> { let (shutdown_sender, _shutdown_receiver) = tokio::sync::broadcast::channel::<()>(1); - let status = shutdown(AdminId(DbId(0)), State(shutdown_sender)).await; + let status = shutdown(AdminId(), State(shutdown_sender)).await; assert_eq!(status, StatusCode::ACCEPTED); Ok(()) @@ -70,7 +69,7 @@ mod tests { async fn bad_shutdown() -> anyhow::Result<()> { let shutdown_sender = Sender::<()>::new(1); - let status = shutdown(AdminId(DbId(0)), State(shutdown_sender)).await; + let status = shutdown(AdminId(), State(shutdown_sender)).await; assert_eq!(status, StatusCode::INTERNAL_SERVER_ERROR); Ok(()) diff --git a/agdb_server/src/routes/user.rs b/agdb_server/src/routes/user.rs index b368ace3..3cf69112 100644 --- a/agdb_server/src/routes/user.rs +++ b/agdb_server/src/routes/user.rs @@ -1,6 +1,7 @@ use crate::config::Config; -use crate::db_pool::DbPool; +use crate::password; use crate::password::Password; +use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResponse; use crate::user_id::UserId; @@ -11,6 +12,7 @@ use agdb_api::UserStatus; use axum::extract::State; use axum::http::StatusCode; use axum::Json; +use uuid::Uuid; #[utoipa::path(post, path = "/api/v1/user/login", @@ -23,11 +25,11 @@ use axum::Json; ) )] pub(crate) async fn login( - State(db_pool): State, + State(server_db): State, Json(request): Json, ) -> ServerResponse<(StatusCode, Json)> { - let user = db_pool - .find_user(&request.username) + let user = server_db + .user(&request.username) .await .map_err(|_| ServerError::new(StatusCode::UNAUTHORIZED, "unuauthorized"))?; let pswd = Password::new(&user.username, &user.password, &user.salt)?; @@ -36,7 +38,14 @@ pub(crate) async fn login( return Err(ServerError::new(StatusCode::UNAUTHORIZED, "unuauthorized")); } - let token = db_pool.user_token(user.db_id.unwrap()).await?; + let user_id = user.db_id.unwrap(); + let mut token = server_db.user_token(user_id).await?; + + if token.is_empty() { + let token_uuid = Uuid::new_v4(); + token = token_uuid.to_string(); + server_db.save_token(user_id, &token).await?; + } Ok((StatusCode::OK, Json(token))) } @@ -51,10 +60,8 @@ pub(crate) async fn login( (status = 401, description = "invalid credentials") ) )] -pub(crate) async fn logout(user: UserId, State(db_pool): State) -> ServerResponse { - let mut user = db_pool.get_user(user.0).await?; - user.token = String::new(); - db_pool.save_user(user).await?; +pub(crate) async fn logout(user: UserId, State(server_db): State) -> ServerResponse { + server_db.save_token(user.0, "").await?; Ok(StatusCode::CREATED) } @@ -73,17 +80,21 @@ pub(crate) async fn logout(user: UserId, State(db_pool): State) -> Serve )] pub(crate) async fn change_password( user: UserId, - State(db_pool): State, + State(server_db): State, Json(request): Json, ) -> ServerResponse { - let user = db_pool.get_user(user.0).await?; + let mut user = server_db.user_by_id(user.0).await?; let old_pswd = Password::new(&user.username, &user.password, &user.salt)?; if !old_pswd.verify_password(&request.password) { return Err(ServerError::new(StatusCode::UNAUTHORIZED, "unuauthorized")); } - db_pool.change_password(user, &request.new_password).await?; + password::validate_password(&request.new_password)?; + let pswd = Password::create(&user.username, &request.new_password); + user.password = pswd.password.to_vec(); + user.salt = pswd.user_salt.to_vec(); + server_db.save_user(user).await?; Ok(StatusCode::CREATED) } diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs index 817b378d..ef3268d2 100644 --- a/agdb_server/src/server_db.rs +++ b/agdb_server/src/server_db.rs @@ -1,3 +1,5 @@ +use crate::config::Config; +use crate::password::Password; use crate::server_error::ServerError; use crate::server_error::ServerResult; use agdb::Comparison; @@ -38,30 +40,70 @@ struct Database { #[derive(Clone)] pub(crate) struct ServerDb(pub(crate) Arc>); +const ADMIN: &str = "admin"; const DBS: &str = "dbs"; const NAME: &str = "name"; const ROLE: &str = "role"; const TOKEN: &str = "token"; const USERS: &str = "users"; const USERNAME: &str = "username"; +const SERVER_DB_FILE: &str = "agdb_server.agdb"; + +pub(crate) async fn new(config: &Config) -> ServerResult { + std::fs::create_dir_all(&config.data_dir)?; + let db_name = format!("mapped:{}/{}", config.data_dir, SERVER_DB_FILE); + let db = ServerDb::new(&db_name)?; + + let admin = if let Some(admin_id) = db.find_user_id(&config.admin).await? { + admin_id + } else { + let admin_password = Password::create(&config.admin, &config.admin); + let admin = ServerUser { + db_id: None, + username: config.admin.clone(), + password: admin_password.password.to_vec(), + salt: admin_password.user_salt.to_vec(), + token: String::new(), + }; + db.insert_user(admin).await? + }; + + db.0.write() + .await + .exec_mut(QueryBuilder::insert().aliases(ADMIN).ids(admin).query())?; + + Ok(db) +} impl ServerDb { - pub(crate) fn load(name: &str) -> ServerResult { - Ok(Self(Arc::new(RwLock::new(Db::new(name)?)))) - } - - pub(crate) fn new(name: &str, admin: ServerUser) -> ServerResult { + fn new(name: &str) -> ServerResult { let mut db = Db::new(name)?; - db.transaction_mut(|t| { - t.exec_mut(QueryBuilder::insert().index(USERNAME).query())?; - t.exec_mut(QueryBuilder::insert().index(TOKEN).query())?; - t.exec_mut(QueryBuilder::insert().nodes().aliases([USERS, DBS]).query())?; - let id = t - .exec_mut(QueryBuilder::insert().element(&admin).query())? - .elements[0] - .id; - t.exec_mut(QueryBuilder::insert().edges().from(USERS).to(id).query()) + db.transaction_mut(|t| -> ServerResult<()> { + let indexes: Vec = t.exec(QueryBuilder::select().indexes().query())?.elements + [0] + .values + .iter() + .map(|kv| kv.key.to_string()) + .collect(); + + if indexes.iter().any(|i| i == USERNAME) { + t.exec_mut(QueryBuilder::insert().index(USERNAME).query())?; + } + + if indexes.iter().any(|i| i == TOKEN) { + t.exec_mut(QueryBuilder::insert().index(TOKEN).query())?; + } + + if t.exec(QueryBuilder::select().ids(USERS).query()).is_err() { + t.exec_mut(QueryBuilder::insert().nodes().aliases(USERS).query())?; + } + + if t.exec(QueryBuilder::select().ids(DBS).query()).is_err() { + t.exec_mut(QueryBuilder::insert().nodes().aliases(DBS).query())?; + } + + Ok(()) })?; Ok(Self(Arc::new(RwLock::new(db)))) @@ -221,6 +263,19 @@ impl ServerDb { }) } + pub(crate) async fn is_admin(&self, token: &str) -> ServerResult { + Ok(self + .0 + .read() + .await + .exec(QueryBuilder::select().values(TOKEN).ids(ADMIN).query())? + .elements[0] + .values[0] + .value + .string()? + == token) + } + pub(crate) async fn is_db_admin(&self, user: DbId, db: DbId) -> ServerResult { Ok(self .0 diff --git a/agdb_server/src/user_id.rs b/agdb_server/src/user_id.rs index d67de1b7..b048e2a8 100644 --- a/agdb_server/src/user_id.rs +++ b/agdb_server/src/user_id.rs @@ -1,5 +1,4 @@ use crate::config::Config; -use crate::db_pool::DbPool; use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::utilities; @@ -15,8 +14,7 @@ use axum_extra::TypedHeader; pub(crate) struct UserId(pub(crate) DbId); -#[expect(dead_code)] -pub(crate) struct AdminId(pub(crate) DbId); +pub(crate) struct AdminId(); pub(crate) struct ClusterId(); @@ -73,19 +71,18 @@ where type Rejection = StatusCode; async fn from_request_parts(parts: &mut Parts, state: &S) -> Result { - let admin_user = &Config::from_ref(state).admin; - let admin = ServerDb::from_ref(state) - .user_token(admin_user.as_str()) - .await - .map_err(unauthorized)?; let bearer: TypedHeader> = parts.extract().await.map_err(unauthorized)?; - if admin.token != utilities::unquote(bearer.token()) { + if !ServerDb::from_ref(state) + .is_admin(utilities::unquote(bearer.token())) + .await + .map_err(unauthorized)? + { return Err(unauthorized(())); } - Ok(Self(admin.db_id.unwrap())) + Ok(Self()) } } From f40d91df710aea75ded6ef785e35c23bcd7b6798 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 20:46:37 +0100 Subject: [PATCH 04/28] user routes --- agdb_server/src/routes/admin/user.rs | 40 +++++++++++++--------------- agdb_server/src/routes/db.rs | 4 ++- agdb_server/src/server_db.rs | 10 ++++++- 3 files changed, 31 insertions(+), 23 deletions(-) diff --git a/agdb_server/src/routes/admin/user.rs b/agdb_server/src/routes/admin/user.rs index 20e3833a..2b625ab2 100644 --- a/agdb_server/src/routes/admin/user.rs +++ b/agdb_server/src/routes/admin/user.rs @@ -1,9 +1,10 @@ use crate::config::Config; use crate::db_pool::DbPool; -use crate::db_pool::ServerUser; use crate::error_code::ErrorCode; use crate::password; use crate::password::Password; +use crate::server_db::ServerDb; +use crate::server_db::ServerUser; use crate::server_error::ServerResponse; use crate::user_id::AdminId; use agdb_api::UserCredentials; @@ -32,21 +33,21 @@ use axum::Json; )] pub(crate) async fn add( _admin_id: AdminId, - State(db_pool): State, + State(server_db): State, Path(username): Path, Json(request): Json, ) -> ServerResponse { password::validate_username(&username)?; password::validate_password(&request.password)?; - if db_pool.find_user_id(&username).await.is_ok() { + if server_db.find_user_id(&username).await?.is_some() { return Err(ErrorCode::UserExists.into()); } let pswd = Password::create(&username, &request.password); - db_pool - .add_user(ServerUser { + server_db + .insert_user(ServerUser { db_id: None, username: username.clone(), password: pswd.password.to_vec(), @@ -76,12 +77,17 @@ pub(crate) async fn add( )] pub(crate) async fn change_password( _admin_id: AdminId, - State(db_pool): State, + State(server_db): State, Path(username): Path, Json(request): Json, ) -> ServerResponse { - let user = db_pool.find_user(&username).await?; - db_pool.change_password(user, &request.password).await?; + let mut user = server_db.user(&username).await?; + + password::validate_password(&request.password)?; + let pswd = Password::create(&user.username, &request.password); + user.password = pswd.password.to_vec(); + user.salt = pswd.user_salt.to_vec(); + server_db.save_user(user).await?; Ok(StatusCode::CREATED) } @@ -98,16 +104,9 @@ pub(crate) async fn change_password( )] pub(crate) async fn list( _admin: AdminId, - State(db_pool): State, - State(config): State, + State(server_db): State, ) -> ServerResponse<(StatusCode, Json>)> { - let mut users = db_pool.find_users().await?; - users - .iter_mut() - .find(|u| u.name == config.admin) - .ok_or("admin user not found")? - .admin = true; - Ok((StatusCode::OK, Json(users))) + Ok((StatusCode::OK, Json(server_db.user_statuses().await?))) } #[utoipa::path(post, @@ -126,12 +125,11 @@ pub(crate) async fn list( )] pub(crate) async fn logout( _admin: AdminId, - State(db_pool): State, + State(server_db): State, Path(username): Path, ) -> ServerResponse { - let mut user = db_pool.find_user(&username).await?; - user.token = String::new(); - db_pool.save_user(user).await?; + let user_id = server_db.user_id(&username).await?; + server_db.save_token(user_id, "").await?; Ok(StatusCode::CREATED) } diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 22884094..9cc0fccd 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -2,6 +2,7 @@ pub(crate) mod user; use crate::config::Config; use crate::db_pool::DbPool; +use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResponse; use crate::user_id::UserId; @@ -59,11 +60,12 @@ pub struct ServerDatabaseResource { pub(crate) async fn add( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { - let current_username = db_pool.user_name(user.0).await?; + let current_username = server_db.user_name(user.0).await?; if current_username != owner { return Err(ServerError::new( diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs index ef3268d2..ae175b0b 100644 --- a/agdb_server/src/server_db.rs +++ b/agdb_server/src/server_db.rs @@ -561,6 +561,14 @@ impl ServerDb { } pub(crate) async fn user_statuses(&self) -> ServerResult> { + let admin_id = self + .0 + .read() + .await + .exec(QueryBuilder::select().aliases().ids(ADMIN).query())? + .elements[0] + .id; + Ok(self .0 .read() @@ -579,7 +587,7 @@ impl ServerDb { .map(|e| UserStatus { name: e.values[0].value.to_string(), login: !e.values[1].value.to_string().is_empty(), - admin: false, + admin: e.id == admin_id, }) .collect()) } From ded6c2222c9a0a7e7e0c53a97e694a8219f47769 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 21:06:00 +0100 Subject: [PATCH 05/28] more refactoring --- agdb_server/src/db_pool.rs | 99 ++++------------------------ agdb_server/src/routes/admin/user.rs | 4 +- agdb_server/src/routes/db.rs | 29 ++++++-- agdb_server/src/routes/db/user.rs | 21 +++++- agdb_server/src/server_db.rs | 2 +- agdb_server/src/server_error.rs | 7 ++ agdb_server/src/utilities.rs | 11 ++-- 7 files changed, 74 insertions(+), 99 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index c5e64949..69a83a05 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -3,11 +3,10 @@ mod user_db_storage; use crate::config::Config; use crate::error_code::ErrorCode; -use crate::password; -use crate::password::Password; use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResult; +use crate::utilities::db_name; use crate::utilities::get_size; use agdb::DbId; use agdb::QueryResult; @@ -34,7 +33,6 @@ use tokio::sync::RwLock; use tokio::sync::RwLockReadGuard; use tokio::sync::RwLockWriteGuard; use user_db::UserDb; -use uuid::Uuid; #[derive(Clone)] pub(crate) struct DbPool(pub(crate) Arc>>); @@ -52,7 +50,7 @@ impl DbPool { db_pool.0.write().await.insert(db.name, server_db); } - db_pool + Ok(db_pool) } pub(crate) async fn add_db( @@ -61,20 +59,8 @@ impl DbPool { db: &str, db_type: DbType, config: &Config, - ) -> ServerResult { - let owner_id = self.0.server_db.user_id(owner).await?; + ) -> ServerResult { let db_name = db_name(owner, db); - - if self - .0 - .server_db - .find_user_db_id(owner_id, &db_name) - .await? - .is_some() - { - return Err(ErrorCode::DbExists.into()); - } - let db_path = Path::new(&config.data_dir).join(&db_name); std::fs::create_dir_all(db_audit_dir(owner, config))?; let path = db_path.to_str().ok_or(ErrorCode::DbInvalid)?.to_string(); @@ -92,48 +78,8 @@ impl DbPool { }; self.get_pool_mut().await.insert(db_name.clone(), server_db); - self.0 - .server_db - .insert_db( - owner_id, - Database { - db_id: None, - name: db_name.clone(), - db_type, - backup, - }, - ) - .await?; - - Ok(()) - } - - pub(crate) async fn add_db_user( - &self, - owner: &str, - db: &str, - username: &str, - role: DbUserRole, - user: DbId, - ) -> ServerResult { - if owner == username { - return Err(permission_denied("cannot change role of db owner")); - } - let db_name = db_name(owner, db); - let db_id = self - .0 - .server_db - .find_user_db_id(user, &db_name) - .await? - .ok_or(db_not_found(&db_name))?; - - if !self.0.server_db.is_db_admin(user, db_id).await? { - return Err(permission_denied("admin only")); - } - - let user_id = self.0.server_db.user_id(username).await?; - self.0.server_db.insert_db_user(db_id, user_id, role).await + Ok(backup) } pub(crate) async fn audit( @@ -188,18 +134,6 @@ impl DbPool { .await } - pub(crate) async fn change_password( - &self, - mut user: ServerUser, - new_password: &str, - ) -> ServerResult { - password::validate_password(new_password)?; - let pswd = Password::create(&user.username, new_password); - user.password = pswd.password.to_vec(); - user.salt = pswd.user_salt.to_vec(); - self.0.server_db.save_user(user).await - } - pub(crate) async fn clear_db( &self, owner: &str, @@ -662,14 +596,18 @@ impl DbPool { Ok(self.get_pool_mut().await.remove(&db_name).unwrap()) } - pub(crate) async fn remove_user(&self, username: &str, config: &Config) -> ServerResult { - let db_names = self.0.server_db.remove_user(username).await?; - - for db in db_names.into_iter() { - self.get_pool_mut().await.remove(&db); + pub(crate) async fn remove_user_dbs( + &self, + username: &str, + dbs: &[String], + config: &Config, + ) -> ServerResult { + for db in dbs { + self.get_pool_mut().await.remove(db); } let user_dir = Path::new(&config.data_dir).join(username); + if user_dir.exists() { std::fs::remove_dir_all(user_dir)?; } @@ -856,17 +794,6 @@ fn db_file(owner: &str, db: &str, config: &Config) -> PathBuf { Path::new(&config.data_dir).join(owner).join(db) } -fn db_name(owner: &str, db: &str) -> String { - format!("{owner}/{db}") -} - -fn permission_denied(message: &str) -> ServerError { - ServerError::new( - StatusCode::FORBIDDEN, - &format!("permission denied: {}", message), - ) -} - fn required_role(queries: &Queries) -> DbUserRole { for q in &queries.0 { match q { diff --git a/agdb_server/src/routes/admin/user.rs b/agdb_server/src/routes/admin/user.rs index 2b625ab2..d1f3581b 100644 --- a/agdb_server/src/routes/admin/user.rs +++ b/agdb_server/src/routes/admin/user.rs @@ -151,10 +151,12 @@ pub(crate) async fn logout( pub(crate) async fn remove( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path(username): Path, ) -> ServerResponse { - db_pool.remove_user(&username, &config).await?; + let dbs = server_db.remove_user(&username).await?; + db_pool.remove_user_dbs(&username, &dbs, &config).await?; Ok(StatusCode::NO_CONTENT) } diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 9cc0fccd..a5687087 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -2,10 +2,13 @@ pub(crate) mod user; use crate::config::Config; use crate::db_pool::DbPool; +use crate::error_code::ErrorCode; +use crate::server_db::Database; use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResponse; use crate::user_id::UserId; +use crate::utilities::db_name; use agdb_api::DbAudit; use agdb_api::DbResource; use agdb_api::DbType; @@ -65,17 +68,35 @@ pub(crate) async fn add( Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { - let current_username = server_db.user_name(user.0).await?; + let username = server_db.user_name(user.0).await?; - if current_username != owner { + if username != owner { return Err(ServerError::new( StatusCode::FORBIDDEN, "cannot add db to another user", )); } - db_pool - .add_db(&owner, &db, request.db_type, &config) + let name = db_name(&username, &db); + + if server_db.find_user_db_id(user.0, &name).await?.is_some() { + return Err(ErrorCode::DbExists.into()); + } + + let backup = db_pool + .add_db(&owner, &name, request.db_type, &config) + .await?; + + server_db + .insert_db( + user.0, + Database { + db_id: None, + name, + db_type: request.db_type, + backup, + }, + ) .await?; Ok(StatusCode::CREATED) diff --git a/agdb_server/src/routes/db/user.rs b/agdb_server/src/routes/db/user.rs index fbdd8b1e..a3bdaf3f 100644 --- a/agdb_server/src/routes/db/user.rs +++ b/agdb_server/src/routes/db/user.rs @@ -1,6 +1,9 @@ use crate::db_pool::DbPool; +use crate::server_db::ServerDb; +use crate::server_error::permission_denied; use crate::server_error::ServerResponse; use crate::user_id::UserId; +use crate::utilities::db_name; use agdb_api::DbUser; use agdb_api::DbUserRole; use axum::extract::Path; @@ -38,12 +41,24 @@ pub(crate) struct DbUserRoleParam { )] pub(crate) async fn add( user: UserId, - State(db_pool): State, + State(server_db): State, Path((owner, db, username)): Path<(String, String, String)>, request: Query, ) -> ServerResponse { - db_pool - .add_db_user(&owner, &db, &username, request.0.db_role, user.0) + if owner == username { + return Err(permission_denied("cannot change role of db owner")); + } + + let db_name = db_name(&owner, &db); + let db_id = server_db.user_db_id(user.0, &db_name).await?; + + if !server_db.is_db_admin(user.0, db_id).await? { + return Err(permission_denied("admin only")); + } + + let user_id = server_db.user_id(&username).await?; + server_db + .insert_db_user(db_id, user_id, request.db_role) .await?; Ok(StatusCode::CREATED) diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs index ae175b0b..e0bb7ca2 100644 --- a/agdb_server/src/server_db.rs +++ b/agdb_server/src/server_db.rs @@ -30,7 +30,7 @@ pub(crate) struct ServerUser { } #[derive(Default, UserValue)] -struct Database { +pub(crate) struct Database { pub(crate) db_id: Option, pub(crate) name: String, pub(crate) db_type: DbType, diff --git a/agdb_server/src/server_error.rs b/agdb_server/src/server_error.rs index 8d0921b8..0536671f 100644 --- a/agdb_server/src/server_error.rs +++ b/agdb_server/src/server_error.rs @@ -35,6 +35,13 @@ impl ServerError { } } +pub(crate) fn permission_denied(message: &str) -> ServerError { + ServerError::new( + StatusCode::FORBIDDEN, + &format!("permission denied: {}", message), + ) +} + #[cfg(test)] mod tests { use super::*; diff --git a/agdb_server/src/utilities.rs b/agdb_server/src/utilities.rs index dbe76380..0471ddce 100644 --- a/agdb_server/src/utilities.rs +++ b/agdb_server/src/utilities.rs @@ -1,9 +1,8 @@ -use std::path::Path; - use crate::server_error::ServerResult; +use std::path::Path; -pub(crate) fn unquote(value: &str) -> &str { - value.trim_start_matches('"').trim_end_matches('"') +pub(crate) fn db_name(owner: &str, db: &str) -> String { + format!("{owner}/{db}") } pub(crate) async fn get_size

(path: P) -> ServerResult @@ -31,3 +30,7 @@ where Ok(size_in_bytes) } + +pub(crate) fn unquote(value: &str) -> &str { + value.trim_start_matches('"').trim_end_matches('"') +} From af9d586ac3bec654c6bc314de46237fe4bc7c8b1 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 21:19:13 +0100 Subject: [PATCH 06/28] backup --- agdb_server/src/db_pool.rs | 77 ++++++++++-------------------- agdb_server/src/db_pool/user_db.rs | 2 + agdb_server/src/routes/db.rs | 27 +++++++++-- 3 files changed, 52 insertions(+), 54 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 69a83a05..54bd69b5 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -38,6 +38,15 @@ use user_db::UserDb; pub(crate) struct DbPool(pub(crate) Arc>>); impl DbPool { + pub(crate) async fn db(&self, name: &str) -> ServerResult { + self.0 + .read() + .await + .get(name) + .cloned() + .ok_or_else(|| ServerError::new(StatusCode::NOT_FOUND, "db not found")) + } + pub(crate) async fn new(config: &Config, server_db: &ServerDb) -> ServerResult { std::fs::create_dir_all(&config.data_dir)?; let db_pool = Self(Arc::new(RwLock::new(HashMap::new()))); @@ -86,16 +95,8 @@ impl DbPool { &self, owner: &str, db: &str, - user: DbId, config: &Config, ) -> ServerResult { - let db_name = db_name(owner, db); - self.0 - .server_db - .find_user_db_id(user, &db_name) - .await? - .ok_or(db_not_found(&db_name))?; - if let Ok(log) = std::fs::OpenOptions::new() .read(true) .open(db_audit_file(owner, db, config)) @@ -110,28 +111,29 @@ impl DbPool { &self, owner: &str, db: &str, - user: DbId, + db_type: DbType, config: &Config, - ) -> ServerResult { + ) -> ServerResult { let db_name = db_name(owner, db); - let mut database = self.0.server_db.user_db(user, &db_name).await?; + let user_db = self.db(&db_name).await?; - if !self - .0 - .server_db - .is_db_admin(user, database.db_id.unwrap()) - .await? - { - return Err(permission_denied("admin only")); + let backup_path = if db_type == DbType::Memory { + db_file(owner, db, config) + } else { + db_backup_file(owner, db, config) + }; + + if backup_path.exists() { + std::fs::remove_file(&backup_path)?; + } else { + std::fs::create_dir_all(db_backup_dir(owner, config))?; } - let pool = self.get_pool().await; - let server_db = pool - .get(&database.name) - .ok_or(db_not_found(&database.name))?; + user_db + .backup(backup_path.to_string_lossy().as_ref()) + .await?; - self.do_backup(owner, db, config, server_db, &mut database) - .await + Ok(SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs()) } pub(crate) async fn clear_db( @@ -240,33 +242,6 @@ impl DbPool { Ok(()) } - async fn do_backup( - &self, - owner: &str, - db: &str, - config: &Config, - server_db: &UserDb, - database: &mut Database, - ) -> Result<(), ServerError> { - let backup_path = if database.db_type == DbType::Memory { - db_file(owner, db, config) - } else { - db_backup_file(owner, db, config) - }; - if backup_path.exists() { - std::fs::remove_file(&backup_path)?; - } else { - std::fs::create_dir_all(db_backup_dir(owner, config))?; - } - server_db - .backup(backup_path.to_string_lossy().as_ref()) - .await?; - - database.backup = SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(); - self.0.server_db.save_db(database).await?; - Ok(()) - } - pub(crate) async fn convert_db( &self, owner: &str, diff --git a/agdb_server/src/db_pool/user_db.rs b/agdb_server/src/db_pool/user_db.rs index 071d7847..9aecf704 100644 --- a/agdb_server/src/db_pool/user_db.rs +++ b/agdb_server/src/db_pool/user_db.rs @@ -19,6 +19,8 @@ use std::time::UNIX_EPOCH; use tokio::sync::RwLock; pub(crate) type UserDbImpl = DbImpl; + +#[derive(Clone)] pub(crate) struct UserDb(pub(crate) Arc>); impl UserDb { diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index a5687087..19c46790 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -5,6 +5,7 @@ use crate::db_pool::DbPool; use crate::error_code::ErrorCode; use crate::server_db::Database; use crate::server_db::ServerDb; +use crate::server_error::permission_denied; use crate::server_error::ServerError; use crate::server_error::ServerResponse; use crate::user_id::UserId; @@ -120,12 +121,17 @@ pub(crate) async fn add( pub(crate) async fn audit( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse<(StatusCode, Json)> { - let results = db_pool.audit(&owner, &db, user.0, &config).await?; + let db_name = db_name(&owner, &db); + server_db.user_db_id(user.0, &db_name).await?; - Ok((StatusCode::OK, Json(results))) + Ok(( + StatusCode::OK, + Json(db_pool.audit(&owner, &db, &config).await?), + )) } #[utoipa::path(post, @@ -147,10 +153,25 @@ pub(crate) async fn audit( pub(crate) async fn backup( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - db_pool.backup_db(&owner, &db, user.0, &config).await?; + let db_name = db_name(&owner, &db); + let mut database = server_db.user_db(user.0, &db_name).await?; + + if !server_db + .is_db_admin(user.0, database.db_id.unwrap()) + .await? + { + return Err(permission_denied("admin only")); + } + + database.backup = db_pool + .backup_db(&owner, &db, database.db_type, &config) + .await?; + + server_db.save_db(&database).await?; Ok(StatusCode::CREATED) } From 186abb560edf80ebf2446ce6c6b7847ab7511325 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 21:58:11 +0100 Subject: [PATCH 07/28] convert db --- agdb_server/src/db_pool.rs | 101 +++++++++++++++-------------------- agdb_server/src/routes/db.rs | 47 ++++++++++++++-- 2 files changed, 87 insertions(+), 61 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 54bd69b5..1dc5919b 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -3,6 +3,7 @@ mod user_db_storage; use crate::config::Config; use crate::error_code::ErrorCode; +use crate::server_db::Database; use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResult; @@ -38,7 +39,7 @@ use user_db::UserDb; pub(crate) struct DbPool(pub(crate) Arc>>); impl DbPool { - pub(crate) async fn db(&self, name: &str) -> ServerResult { + async fn db(&self, name: &str) -> ServerResult { self.0 .read() .await @@ -47,6 +48,17 @@ impl DbPool { .ok_or_else(|| ServerError::new(StatusCode::NOT_FOUND, "db not found")) } + async fn db_size(&self, name: &str) -> ServerResult { + Ok(self + .0 + .read() + .await + .get(name) + .ok_or(db_not_found(name))? + .size() + .await) + } + pub(crate) async fn new(config: &Config, server_db: &ServerDb) -> ServerResult { std::fs::create_dir_all(&config.data_dir)?; let db_pool = Self(Arc::new(RwLock::new(HashMap::new()))); @@ -86,7 +98,7 @@ impl DbPool { 0 }; - self.get_pool_mut().await.insert(db_name.clone(), server_db); + self.0.write().await.insert(db_name.clone(), server_db); Ok(backup) } @@ -111,10 +123,10 @@ impl DbPool { &self, owner: &str, db: &str, + db_name: &str, db_type: DbType, config: &Config, ) -> ServerResult { - let db_name = db_name(owner, db); let user_db = self.db(&db_name).await?; let backup_path = if db_type == DbType::Memory { @@ -140,49 +152,32 @@ impl DbPool { &self, owner: &str, db: &str, - user: DbId, + database: &mut Database, + role: DbUserRole, config: &Config, resource: DbResource, ) -> ServerResult { - let db_name = db_name(owner, db); - let mut database = self.0.server_db.user_db(user, &db_name).await?; - let role = self.0.server_db.user_db_role(user, &db_name).await?; - - if role != DbUserRole::Admin { - return Err(permission_denied("admin only")); - } - match resource { DbResource::All => { - self.do_clear_db(&database, owner, db, config, db_name) - .await?; + self.do_clear_db(owner, db, database, config).await?; do_clear_db_audit(owner, db, config)?; - self.do_clear_db_backup(owner, db, config, &mut database) - .await?; + self.do_clear_db_backup(owner, db, config, database).await?; } DbResource::Db => { - self.do_clear_db(&database, owner, db, config, db_name) - .await?; + self.do_clear_db(owner, db, database, config).await?; } DbResource::Audit => { do_clear_db_audit(owner, db, config)?; } DbResource::Backup => { - self.do_clear_db_backup(owner, db, config, &mut database) - .await?; + self.do_clear_db_backup(owner, db, config, database).await?; } } - let size = self - .get_pool() - .await - .get(&database.name) - .ok_or(db_not_found(&database.name))? - .size() - .await; + let size = self.db_size(&database.name).await?; Ok(ServerDatabase { - name: database.name, + name: database.name.clone(), db_type: database.db_type, role, size, @@ -206,23 +201,21 @@ impl DbPool { std::fs::remove_file(&backup_file)?; } database.backup = 0; - self.0.server_db.save_db(database).await?; Ok(()) } async fn do_clear_db( &self, - database: &Database, owner: &str, db: &str, + database: &Database, config: &Config, - db_name: String, ) -> Result<(), ServerError> { let mut pool = self.get_pool_mut().await; - let server_db = pool + let user_db = pool .get_mut(&database.name) .ok_or(db_not_found(&database.name))?; - *server_db = UserDb::new(&format!("{}:{}", DbType::Memory, database.name))?; + *user_db = UserDb::new(&format!("{}:{}", DbType::Memory, &database.name))?; if database.db_type != DbType::Memory { let main_file = db_file(owner, db, config); if main_file.exists() { @@ -234,9 +227,9 @@ impl DbPool { std::fs::remove_file(wal_file)?; } - let db_path = Path::new(&config.data_dir).join(&db_name); + let db_path = Path::new(&config.data_dir).join(&database.name); let path = db_path.to_str().ok_or(ErrorCode::DbInvalid)?.to_string(); - *server_db = UserDb::new(&format!("{}:{}", database.db_type, path))?; + *user_db = UserDb::new(&format!("{}:{path}", database.db_type))?; } Ok(()) @@ -246,35 +239,29 @@ impl DbPool { &self, owner: &str, db: &str, - user: DbId, + db_name: &str, db_type: DbType, + target_type: DbType, config: &Config, ) -> ServerResult { - let db_name = db_name(owner, db); - let mut database = self.0.server_db.user_db(user, &db_name).await?; - - if database.db_type == db_type { - return Ok(()); - } + let mut user_db = self.0.write().await.remove(db_name).unwrap(); + let current_path = db_file(owner, db, config); - if !self - .0 - .server_db - .is_db_admin(user, database.db_id.unwrap()) - .await? - { - return Err(permission_denied("admin only")); + if db_type == DbType::Memory { + user_db + .0 + .read() + .await + .backup(current_path.to_string_lossy().as_ref())?; } - let mut pool = self.get_pool_mut().await; - pool.remove(&db_name); - - let current_path = db_file(owner, db, config); - let server_db = UserDb::new(&format!("{}:{}", db_type, current_path.to_string_lossy()))?; - pool.insert(db_name, server_db); + user_db = UserDb::new(&format!( + "{}:{}", + target_type, + current_path.to_string_lossy() + ))?; - database.db_type = db_type; - self.0.server_db.save_db(&database).await?; + self.0.write().await.insert(db_name.to_string(), user_db); Ok(()) } diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 19c46790..5a26e80d 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -168,7 +168,7 @@ pub(crate) async fn backup( } database.backup = db_pool - .backup_db(&owner, &db, database.db_type, &config) + .backup_db(&owner, &db, &db_name, database.db_type, &config) .await?; server_db.save_db(&database).await?; @@ -196,14 +196,28 @@ pub(crate) async fn backup( pub(crate) async fn clear( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse<(StatusCode, Json)> { + let db_name = db_name(&owner, &db); + let mut database = server_db.user_db(user.0, &db_name).await?; + let role = server_db.user_db_role(user.0, &db_name).await?; + + if !server_db + .is_db_admin(user.0, database.db_id.unwrap()) + .await? + { + return Err(permission_denied("admin only")); + } + let db = db_pool - .clear_db(&owner, &db, user.0, &config, request.resource) + .clear_db(&owner, &db, &mut database, role, &config, request.resource) .await?; + server_db.save_db(&database).await?; + Ok((StatusCode::OK, Json(db))) } @@ -218,7 +232,7 @@ pub(crate) async fn clear( DbTypeParam, ), responses( - (status = 201, description = "db typ changes"), + (status = 201, description = "db type changes"), (status = 401, description = "unauthorized"), (status = 403, description = "must be a db admin"), (status = 404, description = "user / db not found"), @@ -227,14 +241,39 @@ pub(crate) async fn clear( pub(crate) async fn convert( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { + let db_name = db_name(&owner, &db); + let mut database = server_db.user_db(user.0, &db_name).await?; + + if !server_db + .is_db_admin(user.0, database.db_id.unwrap()) + .await? + { + return Err(permission_denied("admin only")); + } + + if database.db_type == request.db_type { + return Ok(StatusCode::CREATED); + } + db_pool - .convert_db(&owner, &db, user.0, request.db_type, &config) + .convert_db( + &owner, + &db, + &db_name, + database.db_type, + request.db_type, + &config, + ) .await?; + database.db_type = request.db_type; + server_db.save_db(&database).await?; + Ok(StatusCode::CREATED) } From 42b6b86e545b7aef1866e315fdb2b87e9bb405ea Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 22:12:33 +0100 Subject: [PATCH 08/28] delete db --- agdb_server/src/db_pool.rs | 79 +++++++----------------------------- agdb_server/src/routes/db.rs | 44 +++++++++++++++++++- 2 files changed, 56 insertions(+), 67 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 1dc5919b..9eae9801 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -268,38 +268,12 @@ impl DbPool { pub(crate) async fn copy_db( &self, - owner: &str, - db: &str, - new_name: &str, - mut user: DbId, + source_db: &str, + new_owner: &str, + new_db: &str, + target_db: &str, config: &Config, - admin: bool, ) -> ServerResult { - let (new_owner, new_db) = new_name.split_once('/').ok_or(ErrorCode::DbInvalid)?; - let source_db = db_name(owner, db); - let target_db = db_name(new_owner, new_db); - let database = self.0.server_db.user_db(user, &source_db).await?; - - if admin { - user = self.0.server_db.user_id(new_owner).await?; - } else { - let username = self.0.server_db.user_name(user).await?; - - if new_owner != username { - return Err(permission_denied("cannot copy db to another user")); - } - }; - - if self - .0 - .server_db - .find_user_db_id(user, &target_db) - .await? - .is_some() - { - return Err(ErrorCode::DbExists.into()); - } - let target_file = db_file(new_owner, new_db, config); if target_file.exists() { @@ -307,11 +281,10 @@ impl DbPool { } std::fs::create_dir_all(Path::new(&config.data_dir).join(new_owner))?; + let server_db = self - .get_pool() - .await - .get(&source_db) - .ok_or(db_not_found(&source_db))? + .db(&source_db) + .await? .copy(target_file.to_string_lossy().as_ref()) .await .map_err(|e| { @@ -320,21 +293,10 @@ impl DbPool { &format!("db copy error: {}", e.description), ) })?; - self.get_pool_mut() - .await - .insert(target_db.clone(), server_db); self.0 - .server_db - .insert_db( - user, - Database { - db_id: None, - name: target_db.clone(), - db_type: database.db_type, - backup: 0, - }, - ) - .await?; + .write() + .await + .insert(target_db.to_string(), server_db); Ok(()) } @@ -343,10 +305,10 @@ impl DbPool { &self, owner: &str, db: &str, - user: DbId, + db_name: &str, config: &Config, ) -> ServerResult { - self.remove_db(owner, db, user).await?; + self.remove_db(db_name).await?; let main_file = db_file(owner, db, config); if main_file.exists() { @@ -541,21 +503,8 @@ impl DbPool { self.0.server_db.remove_db_user(db_id, user).await } - pub(crate) async fn remove_db( - &self, - owner: &str, - db: &str, - user: DbId, - ) -> ServerResult { - let user_name = self.0.server_db.user_name(user).await?; - - if owner != user_name { - return Err(permission_denied("owner only")); - } - - self.0.server_db.remove_db(user, db).await?; - let db_name = db_name(owner, db); - Ok(self.get_pool_mut().await.remove(&db_name).unwrap()) + pub(crate) async fn remove_db(&self, db_name: &str) -> ServerResult { + Ok(self.0.write().await.remove(db_name).unwrap()) } pub(crate) async fn remove_user_dbs( diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 5a26e80d..ebb410c5 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -299,12 +299,43 @@ pub(crate) async fn convert( pub(crate) async fn copy( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { + let (new_owner, new_db) = request + .new_name + .split_once('/') + .ok_or(ErrorCode::DbInvalid)?; + let source_db = db_name(&owner, &db); + let target_db = db_name(new_owner, new_db); + let db_type = server_db.user_db(user.0, &source_db).await?.db_type; + let username = server_db.user_name(user.0).await?; + + if new_owner != username { + return Err(permission_denied("cannot copy db to another user")); + } + + if server_db + .find_user_db_id(user.0, &target_db) + .await? + .is_some() + { + return Err(ErrorCode::DbExists.into()); + } + db_pool - .copy_db(&owner, &db, &request.new_name, user.0, &config, false) + .copy_db(&source_db, new_owner, new_db, &target_db, &config) + .await?; + + server_db + .save_db(&Database { + db_id: None, + name: target_db, + db_type, + backup: 0, + }) .await?; Ok(StatusCode::CREATED) @@ -329,10 +360,19 @@ pub(crate) async fn copy( pub(crate) async fn delete( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - db_pool.delete_db(&owner, &db, user.0, &config).await?; + let user_name = server_db.user_name(user.0).await?; + + if owner != user_name { + return Err(permission_denied("owner only")); + } + + let db = db_name(&owner, &db); + server_db.remove_db(user.0, &db).await?; + db_pool.delete_db(&owner, &db, &db, &config).await?; Ok(StatusCode::NO_CONTENT) } From e55f1ac000b276cfaae1b14780e4d0f3bd0636ed Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 22:21:24 +0100 Subject: [PATCH 09/28] exec --- agdb_server/src/db_pool.rs | 94 +++++++++++------------------------- agdb_server/src/routes/db.rs | 20 +++++++- agdb_server/src/utilities.rs | 23 +++++++++ 3 files changed, 71 insertions(+), 66 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 9eae9801..26de1720 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -3,6 +3,7 @@ mod user_db_storage; use crate::config::Config; use crate::error_code::ErrorCode; +use crate::routes::db; use crate::server_db::Database; use crate::server_db::ServerDb; use crate::server_error::ServerError; @@ -334,60 +335,42 @@ impl DbPool { } pub(crate) async fn exec( + &self, + db_name: &str, + queries: Queries, + ) -> ServerResult> { + self.db(db_name).await?.exec(queries).await + } + + pub(crate) async fn exec_mut( &self, owner: &str, db: &str, - user: DbId, + db_name: &str, + username: &str, queries: Queries, config: &Config, ) -> ServerResult> { - let db_name = db_name(owner, db); - let role = self.0.server_db.user_db_role(user, &db_name).await?; - let required_role = required_role(&queries); - - if required_role == DbUserRole::Write && role == DbUserRole::Read { - return Err(permission_denied("write rights required")); - } - - let results = if required_role == DbUserRole::Read { - self.get_pool() - .await - .get(&db_name) - .ok_or(db_not_found(&db_name))? - .exec(queries) - .await - } else { - let username = self.0.server_db.user_name(user).await?; - - let (r, audit) = self - .get_pool() - .await - .get(&db_name) - .ok_or(db_not_found(&db_name))? - .exec_mut(queries, &username) - .await?; - - if !audit.is_empty() { - let mut log = std::fs::OpenOptions::new() - .create(true) - .truncate(false) - .write(true) - .open(db_audit_file(owner, db, config))?; - let len = log.seek(SeekFrom::End(0))?; - if len == 0 { - serde_json::to_writer(&log, &audit)?; - } else { - let mut data = serde_json::to_vec(&audit)?; - data[0] = b','; - log.seek(SeekFrom::End(-1))?; - log.write_all(&data)?; - } + let (r, audit) = self.db(db_name).await?.exec_mut(queries, &username).await?; + + if !audit.is_empty() { + let mut log = std::fs::OpenOptions::new() + .create(true) + .truncate(false) + .write(true) + .open(db_audit_file(owner, db, config))?; + let len = log.seek(SeekFrom::End(0))?; + if len == 0 { + serde_json::to_writer(&log, &audit)?; + } else { + let mut data = serde_json::to_vec(&audit)?; + data[0] = b','; + log.seek(SeekFrom::End(-1))?; + log.write_all(&data)?; } + } - Ok(r) - }?; - - Ok(results) + Ok(r) } pub(crate) async fn find_dbs(&self) -> ServerResult> { @@ -704,22 +687,3 @@ fn db_audit_file(owner: &str, db: &str, config: &Config) -> PathBuf { fn db_file(owner: &str, db: &str, config: &Config) -> PathBuf { Path::new(&config.data_dir).join(owner).join(db) } - -fn required_role(queries: &Queries) -> DbUserRole { - for q in &queries.0 { - match q { - QueryType::InsertAlias(_) - | QueryType::InsertEdges(_) - | QueryType::InsertNodes(_) - | QueryType::InsertValues(_) - | QueryType::Remove(_) - | QueryType::RemoveAliases(_) - | QueryType::RemoveValues(_) => { - return DbUserRole::Write; - } - _ => {} - } - } - - DbUserRole::Read -} diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index ebb410c5..2c642a2a 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -10,9 +10,11 @@ use crate::server_error::ServerError; use crate::server_error::ServerResponse; use crate::user_id::UserId; use crate::utilities::db_name; +use crate::utilities::required_role; use agdb_api::DbAudit; use agdb_api::DbResource; use agdb_api::DbType; +use agdb_api::DbUserRole; use agdb_api::Queries; use agdb_api::QueriesResults; use agdb_api::ServerDatabase; @@ -397,11 +399,27 @@ pub(crate) async fn delete( pub(crate) async fn exec( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, Json(queries): Json, ) -> ServerResponse<(StatusCode, Json)> { - let results = db_pool.exec(&owner, &db, user.0, queries, &config).await?; + let db_name = db_name(&owner, &db); + let role = server_db.user_db_role(user.0, &db_name).await?; + let required_role = required_role(&queries); + + if required_role == DbUserRole::Write && role == DbUserRole::Read { + return Err(permission_denied("write rights required")); + } + + let results = if required_role == DbUserRole::Read { + db_pool.exec(&db_name, queries).await? + } else { + let username = server_db.user_name(user.0).await?; + db_pool + .exec_mut(&owner, &db, &db_name, &username, queries, &config) + .await? + }; Ok((StatusCode::OK, Json(QueriesResults(results)))) } diff --git a/agdb_server/src/utilities.rs b/agdb_server/src/utilities.rs index 0471ddce..0e8e517f 100644 --- a/agdb_server/src/utilities.rs +++ b/agdb_server/src/utilities.rs @@ -1,3 +1,7 @@ +use agdb::QueryType; +use agdb_api::DbUserRole; +use agdb_api::Queries; + use crate::server_error::ServerResult; use std::path::Path; @@ -31,6 +35,25 @@ where Ok(size_in_bytes) } +pub(crate) fn required_role(queries: &Queries) -> DbUserRole { + for q in &queries.0 { + match q { + QueryType::InsertAlias(_) + | QueryType::InsertEdges(_) + | QueryType::InsertNodes(_) + | QueryType::InsertValues(_) + | QueryType::Remove(_) + | QueryType::RemoveAliases(_) + | QueryType::RemoveValues(_) => { + return DbUserRole::Write; + } + _ => {} + } + } + + DbUserRole::Read +} + pub(crate) fn unquote(value: &str) -> &str { value.trim_start_matches('"').trim_end_matches('"') } From 0b75eb8618cce4f7085d1fbad7e7f477dd6a40a0 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 22:38:26 +0100 Subject: [PATCH 10/28] db users --- agdb_server/src/db_pool.rs | 137 ++++-------------------------- agdb_server/src/routes/db.rs | 47 +++++++++- agdb_server/src/routes/db/user.rs | 24 ++++-- 3 files changed, 74 insertions(+), 134 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 26de1720..1c12037f 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -49,17 +49,6 @@ impl DbPool { .ok_or_else(|| ServerError::new(StatusCode::NOT_FOUND, "db not found")) } - async fn db_size(&self, name: &str) -> ServerResult { - Ok(self - .0 - .read() - .await - .get(name) - .ok_or(db_not_found(name))? - .size() - .await) - } - pub(crate) async fn new(config: &Config, server_db: &ServerDb) -> ServerResult { std::fs::create_dir_all(&config.data_dir)?; let db_pool = Self(Arc::new(RwLock::new(HashMap::new()))); @@ -186,6 +175,17 @@ impl DbPool { }) } + pub(crate) async fn db_size(&self, name: &str) -> ServerResult { + Ok(self + .0 + .read() + .await + .get(name) + .ok_or(db_not_found(name))? + .size() + .await) + } + async fn do_clear_db_backup( &self, owner: &str, @@ -373,117 +373,10 @@ impl DbPool { Ok(r) } - pub(crate) async fn find_dbs(&self) -> ServerResult> { - let pool = self.get_pool().await; - let dbs = self.0.server_db.dbs().await?; - - let mut databases = Vec::with_capacity(dbs.len()); - - for db in dbs { - databases.push(ServerDatabase { - db_type: db.db_type, - role: DbUserRole::Admin, - size: pool - .get(&db.name) - .ok_or(db_not_found(&db.name))? - .size() - .await, - backup: db.backup, - name: db.name, - }); - } - - Ok(databases) - } - - pub(crate) async fn find_user_dbs(&self, user: DbId) -> ServerResult> { - let user_dbs = self.0.server_db.user_dbs(user).await?; - let mut dbs: Vec = user_dbs - .into_iter() - .map(|(role, db)| ServerDatabase { - name: db.name, - db_type: db.db_type, - role, - size: 0, - backup: db.backup, - }) - .collect(); - - for db in dbs.iter_mut() { - db.size = self - .get_pool() - .await - .get(&db.name) - .ok_or(db_not_found(&db.name))? - .size() - .await; - } - - Ok(dbs) - } - - pub(crate) async fn db_users( - &self, - owner: &str, - db: &str, - user: DbId, - ) -> ServerResult> { - let db = db_name(owner, db); - let db_id = self.0.server_db.user_db_id(user, &db).await?; - self.0.server_db.db_users(db_id).await - } - - pub(crate) async fn optimize_db( - &self, - owner: &str, - db: &str, - user: DbId, - ) -> ServerResult { - let db_name = db_name(owner, db); - let db = self.0.server_db.user_db(user, &db_name).await?; - let role = self.0.server_db.user_db_role(user, &db_name).await?; - - if role == DbUserRole::Read { - return Err(permission_denied("write rights required")); - } - - let pool = self.get_pool().await; - let server_db = pool.get(&db.name).ok_or(db_not_found(&db.name))?; - server_db.optimize_storage().await?; - let size = server_db.size().await; - - Ok(ServerDatabase { - name: db.name, - db_type: db.db_type, - role, - size, - backup: db.backup, - }) - } - - pub(crate) async fn remove_db_user( - &self, - owner: &str, - db: &str, - username: &str, - user: DbId, - ) -> ServerResult { - if owner == username { - return Err(permission_denied("cannot remove owner")); - } - - let db_id = self - .0 - .server_db - .user_db_id(user, &db_name(owner, db)) - .await?; - let user_id = self.0.server_db.user_id(username).await?; - - if user != user_id && !self.0.server_db.is_db_admin(user, db_id).await? { - return Err(permission_denied("admin only")); - } - - self.0.server_db.remove_db_user(db_id, user).await + pub(crate) async fn optimize_db(&self, db_name: &str) -> ServerResult { + let user_db = self.db(&db_name).await?; + user_db.optimize_storage().await?; + Ok(user_db.size().await) } pub(crate) async fn remove_db(&self, db_name: &str) -> ServerResult { diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 2c642a2a..9886f742 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -437,8 +437,20 @@ pub(crate) async fn exec( pub(crate) async fn list( user: UserId, State(db_pool): State, + State(server_db): State, ) -> ServerResponse<(StatusCode, Json>)> { - let dbs = db_pool.find_user_dbs(user.0).await?; + let databases = server_db.user_dbs(user.0).await?; + let mut dbs = Vec::with_capacity(databases.len()); + + for db in databases { + dbs.push(ServerDatabase { + size: db_pool.db_size(&db.1.name).await?, + name: db.1.name, + db_type: db.1.db_type, + role: db.0, + backup: db.1.backup, + }); + } Ok((StatusCode::OK, Json(dbs))) } @@ -461,11 +473,29 @@ pub(crate) async fn list( pub(crate) async fn optimize( user: UserId, State(db_pool): State, + State(server_db): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse<(StatusCode, Json)> { - let db = db_pool.optimize_db(&owner, &db, user.0).await?; + let db_name = db_name(&owner, &db); + let database = server_db.user_db(user.0, &db_name).await?; + let role = server_db.user_db_role(user.0, &db_name).await?; - Ok((StatusCode::OK, Json(db))) + if role == DbUserRole::Read { + return Err(permission_denied("write rights required")); + } + + let size = db_pool.optimize_db(&db_name).await?; + + Ok(( + StatusCode::OK, + Json(ServerDatabase { + name: db_name, + db_type: database.db_type, + role, + backup: database.backup, + size, + }), + )) } #[utoipa::path(delete, @@ -487,9 +517,18 @@ pub(crate) async fn optimize( pub(crate) async fn remove( user: UserId, State(db_pool): State, + State(server_db): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - db_pool.remove_db(&owner, &db, user.0).await?; + let user_name = server_db.user_name(user.0).await?; + + if owner != user_name { + return Err(permission_denied("owner only")); + } + + let db = db_name(&owner, &db); + server_db.remove_db(user.0, &db).await?; + db_pool.remove_db(&db).await?; Ok(StatusCode::NO_CONTENT) } diff --git a/agdb_server/src/routes/db/user.rs b/agdb_server/src/routes/db/user.rs index a3bdaf3f..76300a3f 100644 --- a/agdb_server/src/routes/db/user.rs +++ b/agdb_server/src/routes/db/user.rs @@ -1,4 +1,3 @@ -use crate::db_pool::DbPool; use crate::server_db::ServerDb; use crate::server_error::permission_denied; use crate::server_error::ServerResponse; @@ -81,12 +80,12 @@ pub(crate) async fn add( )] pub(crate) async fn list( user: UserId, - State(db_pool): State, + State(server_db): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse<(StatusCode, Json>)> { - let users = db_pool.db_users(&owner, &db, user.0).await?; + let db_id = server_db.user_db_id(user.0, &db_name(&owner, &db)).await?; - Ok((StatusCode::OK, Json(users))) + Ok((StatusCode::OK, Json(server_db.db_users(db_id).await?))) } #[utoipa::path(post, @@ -108,12 +107,21 @@ pub(crate) async fn list( )] pub(crate) async fn remove( user: UserId, - State(db_pool): State, + State(server_db): State, Path((owner, db, username)): Path<(String, String, String)>, ) -> ServerResponse { - db_pool - .remove_db_user(&owner, &db, &username, user.0) - .await?; + if owner == username { + return Err(permission_denied("cannot remove owner")); + } + + let db_id = server_db.user_db_id(user.0, &db_name(&owner, &db)).await?; + let user_id = server_db.user_id(&username).await?; + + if user.0 != user_id && !server_db.is_db_admin(user.0, db_id).await? { + return Err(permission_denied("admin only")); + } + + server_db.remove_db_user(db_id, user_id).await?; Ok(StatusCode::NO_CONTENT) } From 14bd74ff81fb0ba490b3d04ffe07018c504fbb7d Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 23:06:13 +0100 Subject: [PATCH 11/28] finish db_pool --- agdb_server/src/db_pool.rs | 115 +++++++------------------------- agdb_server/src/routes/admin.rs | 19 ++++-- agdb_server/src/routes/db.rs | 58 +++++++++++++++- 3 files changed, 95 insertions(+), 97 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 1c12037f..3060aeec 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -3,21 +3,15 @@ mod user_db_storage; use crate::config::Config; use crate::error_code::ErrorCode; -use crate::routes::db; use crate::server_db::Database; use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResult; use crate::utilities::db_name; -use crate::utilities::get_size; -use agdb::DbId; use agdb::QueryResult; -use agdb::QueryType; -use agdb_api::AdminStatus; use agdb_api::DbAudit; use agdb_api::DbResource; use agdb_api::DbType; -use agdb_api::DbUser; use agdb_api::DbUserRole; use agdb_api::Queries; use agdb_api::ServerDatabase; @@ -32,8 +26,6 @@ use std::sync::Arc; use std::time::SystemTime; use std::time::UNIX_EPOCH; use tokio::sync::RwLock; -use tokio::sync::RwLockReadGuard; -use tokio::sync::RwLockWriteGuard; use user_db::UserDb; #[derive(Clone)] @@ -212,7 +204,7 @@ impl DbPool { database: &Database, config: &Config, ) -> Result<(), ServerError> { - let mut pool = self.get_pool_mut().await; + let mut pool = self.0.write().await; let user_db = pool .get_mut(&database.name) .ok_or(db_not_found(&database.name))?; @@ -390,7 +382,7 @@ impl DbPool { config: &Config, ) -> ServerResult { for db in dbs { - self.get_pool_mut().await.remove(db); + self.0.write().await.remove(db); } let user_dir = Path::new(&config.data_dir).join(username); @@ -406,24 +398,12 @@ impl DbPool { &self, owner: &str, db: &str, - new_name: &str, - user: DbId, + source_db: &str, + new_owner: &str, + new_db: &str, + target_db: &str, config: &Config, ) -> ServerResult { - let db_name = db_name(owner, db); - - if db_name == new_name { - return Ok(()); - } - - let (new_owner, new_db) = new_name.split_once('/').ok_or(ErrorCode::DbInvalid)?; - let username = self.0.server_db.user_name(user).await?; - - if owner != username { - return Err(permission_denied("owner only")); - } - - let mut database = self.0.server_db.user_db(user, &db_name).await?; let target_name = db_file(new_owner, new_db, config); if target_name.exists() { @@ -432,20 +412,11 @@ impl DbPool { if new_owner != owner { std::fs::create_dir_all(Path::new(&config.data_dir).join(new_owner))?; - self.add_db_user(owner, db, new_owner, DbUserRole::Admin, user) - .await?; } - let server_db = UserDb( - self.get_pool() - .await - .get(&db_name) - .ok_or(db_not_found(&db_name))? - .0 - .clone(), - ); + let user_db = self.db(source_db).await?; - server_db + user_db .rename(target_name.to_string_lossy().as_ref()) .await .map_err(|mut e| { @@ -454,6 +425,7 @@ impl DbPool { })?; let backup_path = db_backup_file(owner, db, config); + if backup_path.exists() { let new_backup_path = db_backup_file(new_owner, new_db, config); let backups_dir = new_backup_path.parent().unwrap(); @@ -461,14 +433,8 @@ impl DbPool { std::fs::rename(backup_path, new_backup_path)?; } - self.get_pool_mut() - .await - .insert(new_name.to_string(), server_db); - - database.name = new_name.to_string(); - self.0.server_db.save_db(&database).await?; - - self.get_pool_mut().await.remove(&db_name).unwrap(); + self.0.write().await.insert(target_db.to_string(), user_db); + self.0.write().await.remove(source_db).unwrap(); Ok(()) } @@ -477,22 +443,11 @@ impl DbPool { &self, owner: &str, db: &str, - user: DbId, + db_name: &str, + db_type: DbType, config: &Config, - ) -> ServerResult { - let db_name = db_name(owner, db); - let mut database = self.0.server_db.user_db(user, &db_name).await?; - - if !self - .0 - .server_db - .is_db_admin(user, database.db_id.unwrap()) - .await? - { - return Err(permission_denied("admin only")); - } - - let backup_path = if database.db_type == DbType::Memory { + ) -> ServerResult> { + let backup_path = if db_type == DbType::Memory { db_file(owner, db, config) } else { db_backup_file(owner, db, config) @@ -505,45 +460,23 @@ impl DbPool { }); } - let mut pool = self.get_pool_mut().await; - pool.remove(&db_name); + self.0.write().await.remove(db_name); let current_path = db_file(owner, db, config); - if database.db_type != DbType::Memory { + let backup = if db_type != DbType::Memory { let backup_temp = db_backup_dir(owner, config).join(db); std::fs::rename(¤t_path, &backup_temp)?; std::fs::rename(&backup_path, ¤t_path)?; std::fs::rename(backup_temp, backup_path)?; - database.backup = SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(); - } - - let server_db = UserDb::new(&format!( - "{}:{}", - database.db_type, - current_path.to_string_lossy() - ))?; - pool.insert(db_name, server_db); - self.0.server_db.save_db(&database).await?; - - Ok(()) - } - - pub(crate) async fn status(&self, config: &Config) -> ServerResult { - Ok(AdminStatus { - uptime: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() - config.start_time, - dbs: self.0.server_db.db_count().await?, - users: self.0.server_db.user_count().await?, - logged_in_users: self.0.server_db.user_token_count().await?, - size: get_size(&config.data_dir).await?, - }) - } + Some(SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs()) + } else { + None + }; - async fn get_pool(&self) -> RwLockReadGuard> { - self.0.pool.read().await - } + let user_db = UserDb::new(&format!("{}:{}", db_type, current_path.to_string_lossy()))?; + self.0.write().await.insert(db_name.to_string(), user_db); - async fn get_pool_mut(&self) -> RwLockWriteGuard> { - self.0.pool.write().await + Ok(backup) } } diff --git a/agdb_server/src/routes/admin.rs b/agdb_server/src/routes/admin.rs index 4049b23f..8a774f9f 100644 --- a/agdb_server/src/routes/admin.rs +++ b/agdb_server/src/routes/admin.rs @@ -2,13 +2,16 @@ pub(crate) mod db; pub(crate) mod user; use crate::config::Config; -use crate::db_pool::DbPool; +use crate::server_db::ServerDb; use crate::server_error::ServerResponse; use crate::user_id::AdminId; +use crate::utilities::get_size; use agdb_api::AdminStatus; use axum::extract::State; use axum::http::StatusCode; use axum::Json; +use std::time::SystemTime; +use std::time::UNIX_EPOCH; use tokio::sync::broadcast::Sender; #[utoipa::path(post, @@ -44,11 +47,19 @@ pub(crate) async fn shutdown( )] pub(crate) async fn status( _admin_id: AdminId, + State(server_db): State, State(config): State, - State(db_pool): State, ) -> ServerResponse<(StatusCode, Json)> { - let status = db_pool.status(&config).await?; - Ok((StatusCode::OK, Json(status))) + Ok(( + StatusCode::OK, + Json(AdminStatus { + uptime: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() - config.start_time, + dbs: server_db.db_count().await?, + users: server_db.user_count().await?, + logged_in_users: server_db.user_token_count().await?, + size: get_size(&config.data_dir).await?, + }), + )) } #[cfg(test)] diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 9886f742..db9d8065 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -11,6 +11,7 @@ use crate::server_error::ServerResponse; use crate::user_id::UserId; use crate::utilities::db_name; use crate::utilities::required_role; +use agdb::Db; use agdb_api::DbAudit; use agdb_api::DbResource; use agdb_api::DbType; @@ -555,14 +556,50 @@ pub(crate) async fn remove( pub(crate) async fn rename( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { + let db_name = db_name(&owner, &db); + + if db_name == request.new_name { + return Ok(StatusCode::CREATED); + } + + let (new_owner, new_db) = request + .new_name + .split_once('/') + .ok_or(ErrorCode::DbInvalid)?; + let new_owner_id = server_db.user_id(new_owner).await?; + + if owner != server_db.user_name(user.0).await? { + return Err(permission_denied("owner only")); + } + + let mut database = server_db.user_db(user.0, &db_name).await?; + db_pool - .rename_db(&owner, &db, &request.new_name, user.0, &config) + .rename_db( + &owner, + &db, + &db_name, + new_owner, + new_db, + &request.new_name, + &config, + ) .await?; + database.name = request.new_name.clone(); + server_db.save_db(&database).await?; + + if new_owner != owner { + server_db + .insert_db_user(database.db_id.unwrap(), new_owner_id, DbUserRole::Admin) + .await?; + } + Ok(StatusCode::CREATED) } @@ -585,10 +622,27 @@ pub(crate) async fn rename( pub(crate) async fn restore( user: UserId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - db_pool.restore_db(&owner, &db, user.0, &config).await?; + let db_name = db_name(&owner, &db); + let mut database = server_db.user_db(user.0, &db_name).await?; + + if !server_db + .is_db_admin(user.0, database.db_id.unwrap()) + .await? + { + return Err(permission_denied("admin only")); + } + + if let Some(backup) = db_pool + .restore_db(&owner, &db, &db_name, database.db_type, &config) + .await? + { + database.backup = backup; + server_db.save_db(&database).await?; + } Ok(StatusCode::CREATED) } From a2f0fc6dd568335ccdded2e6528e12ae686101e1 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 23:11:53 +0100 Subject: [PATCH 12/28] fix admin db user --- agdb_server/src/routes/admin/db/user.rs | 43 +++++++++++++++++-------- agdb_server/src/routes/db.rs | 1 - 2 files changed, 30 insertions(+), 14 deletions(-) diff --git a/agdb_server/src/routes/admin/db/user.rs b/agdb_server/src/routes/admin/db/user.rs index 220cee9e..9daf80ac 100644 --- a/agdb_server/src/routes/admin/db/user.rs +++ b/agdb_server/src/routes/admin/db/user.rs @@ -1,7 +1,9 @@ -use crate::db_pool::DbPool; use crate::routes::db::user::DbUserRoleParam; +use crate::server_db::ServerDb; +use crate::server_error::permission_denied; use crate::server_error::ServerResponse; use crate::user_id::AdminId; +use crate::utilities::db_name; use agdb_api::DbUser; use axum::extract::Path; use axum::extract::Query; @@ -29,13 +31,19 @@ use axum::Json; )] pub(crate) async fn add( _admin: AdminId, - State(db_pool): State, + State(server_db): State, Path((owner, db, username)): Path<(String, String, String)>, request: Query, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; - db_pool - .add_db_user(&owner, &db, &username, request.0.db_role, owner_id) + if owner == username { + return Err(permission_denied("cannot change role of db owner")); + } + + let owner_id = server_db.user_id(&owner).await?; + let db_id = server_db.user_db_id(owner_id, &db).await?; + let user_id = server_db.user_id(&username).await?; + server_db + .insert_db_user(db_id, user_id, request.db_role) .await?; Ok(StatusCode::CREATED) @@ -58,13 +66,15 @@ pub(crate) async fn add( )] pub(crate) async fn list( _admin: AdminId, - State(db_pool): State, + State(server_db): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse<(StatusCode, Json>)> { - let owner_id = db_pool.find_user_id(&owner).await?; - let users = db_pool.db_users(&owner, &db, owner_id).await?; + let owner_id = server_db.user_id(&owner).await?; + let db_id = server_db + .user_db_id(owner_id, &db_name(&owner, &db)) + .await?; - Ok((StatusCode::OK, Json(users))) + Ok((StatusCode::OK, Json(server_db.db_users(db_id).await?))) } #[utoipa::path(delete, @@ -86,13 +96,20 @@ pub(crate) async fn list( )] pub(crate) async fn remove( _admin: AdminId, - State(db_pool): State, + State(server_db): State, Path((owner, db, username)): Path<(String, String, String)>, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; - db_pool - .remove_db_user(&owner, &db, &username, owner_id) + if owner == username { + return Err(permission_denied("cannot remove owner")); + } + + let owner_id = server_db.user_id(&owner).await?; + let db_id = server_db + .user_db_id(owner_id, &db_name(&owner, &db)) .await?; + let user_id = server_db.user_id(&username).await?; + + server_db.remove_db_user(db_id, user_id).await?; Ok(StatusCode::NO_CONTENT) } diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index db9d8065..8a44ff8b 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -11,7 +11,6 @@ use crate::server_error::ServerResponse; use crate::user_id::UserId; use crate::utilities::db_name; use crate::utilities::required_role; -use agdb::Db; use agdb_api::DbAudit; use agdb_api::DbResource; use agdb_api::DbType; From 8bc054c46253cd1452ffdb4da8b1418cf1e101e0 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 23:14:25 +0100 Subject: [PATCH 13/28] db add --- agdb_server/src/routes/admin/db.rs | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/agdb_server/src/routes/admin/db.rs b/agdb_server/src/routes/admin/db.rs index 36bf7213..f86ee1aa 100644 --- a/agdb_server/src/routes/admin/db.rs +++ b/agdb_server/src/routes/admin/db.rs @@ -2,10 +2,14 @@ pub(crate) mod user; use crate::config::Config; use crate::db_pool::DbPool; +use crate::error_code::ErrorCode; use crate::routes::db::DbTypeParam; use crate::routes::db::ServerDatabaseRename; +use crate::server_db::Database; +use crate::server_db::ServerDb; use crate::server_error::ServerResponse; use crate::user_id::AdminId; +use crate::utilities::db_name; use agdb_api::DbAudit; use agdb_api::Queries; use agdb_api::QueriesResults; @@ -36,12 +40,32 @@ use axum::Json; pub(crate) async fn add( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { - db_pool - .add_db(&owner, &db, request.db_type, &config) + let name = db_name(&owner, &db); + let user = server_db.user_id(&owner).await?; + + if server_db.find_user_db_id(user, &name).await?.is_some() { + return Err(ErrorCode::DbExists.into()); + } + + let backup = db_pool + .add_db(&owner, &name, request.db_type, &config) + .await?; + + server_db + .insert_db( + user, + Database { + db_id: None, + name, + db_type: request.db_type, + backup, + }, + ) .await?; Ok(StatusCode::CREATED) From 812939c6ac058e2c066afb75d6d6172e50fa53a1 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 23:35:45 +0100 Subject: [PATCH 14/28] finish --- agdb_api/rust/src/api.rs | 15 ++ agdb_server/src/app.rs | 4 + agdb_server/src/db_pool.rs | 9 +- agdb_server/src/routes/admin/db.rs | 234 +++++++++++++++++++++++++---- agdb_server/src/server_db.rs | 15 +- 5 files changed, 235 insertions(+), 42 deletions(-) diff --git a/agdb_api/rust/src/api.rs b/agdb_api/rust/src/api.rs index f738e638..d422f10c 100644 --- a/agdb_api/rust/src/api.rs +++ b/agdb_api/rust/src/api.rs @@ -79,6 +79,21 @@ impl AgdbApi { .0) } + pub async fn admin_db_clear( + &self, + owner: &str, + db: &str, + resource: DbResource, + ) -> AgdbApiResult<(u16, ServerDatabase)> { + self.client + .post::<(), ServerDatabase>( + &self.url(&format!("/admin/db/{owner}/{db}/clear?resource={resource}")), + &None, + &self.token, + ) + .await + } + pub async fn admin_db_convert( &self, owner: &str, diff --git a/agdb_server/src/app.rs b/agdb_server/src/app.rs index 1c0a7432..2cf2ada9 100644 --- a/agdb_server/src/app.rs +++ b/agdb_server/src/app.rs @@ -67,6 +67,10 @@ pub(crate) fn app( "/admin/db/:user/:db/backup", routing::post(routes::admin::db::backup), ) + .route( + "/admin/db/:user/:db/clear", + routing::post(routes::admin::db::clear), + ) .route( "/admin/db/:user/:db/convert", routing::post(routes::admin::db::convert), diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 3060aeec..cd52eff0 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -109,7 +109,7 @@ impl DbPool { db_type: DbType, config: &Config, ) -> ServerResult { - let user_db = self.db(&db_name).await?; + let user_db = self.db(db_name).await?; let backup_path = if db_type == DbType::Memory { db_file(owner, db, config) @@ -276,7 +276,7 @@ impl DbPool { std::fs::create_dir_all(Path::new(&config.data_dir).join(new_owner))?; let server_db = self - .db(&source_db) + .db(source_db) .await? .copy(target_file.to_string_lossy().as_ref()) .await @@ -343,7 +343,7 @@ impl DbPool { queries: Queries, config: &Config, ) -> ServerResult> { - let (r, audit) = self.db(db_name).await?.exec_mut(queries, &username).await?; + let (r, audit) = self.db(db_name).await?.exec_mut(queries, username).await?; if !audit.is_empty() { let mut log = std::fs::OpenOptions::new() @@ -366,7 +366,7 @@ impl DbPool { } pub(crate) async fn optimize_db(&self, db_name: &str) -> ServerResult { - let user_db = self.db(&db_name).await?; + let user_db = self.db(db_name).await?; user_db.optimize_storage().await?; Ok(user_db.size().await) } @@ -394,6 +394,7 @@ impl DbPool { Ok(()) } + #[expect(clippy::too_many_arguments)] pub(crate) async fn rename_db( &self, owner: &str, diff --git a/agdb_server/src/routes/admin/db.rs b/agdb_server/src/routes/admin/db.rs index f86ee1aa..26b6d1fd 100644 --- a/agdb_server/src/routes/admin/db.rs +++ b/agdb_server/src/routes/admin/db.rs @@ -5,12 +5,15 @@ use crate::db_pool::DbPool; use crate::error_code::ErrorCode; use crate::routes::db::DbTypeParam; use crate::routes::db::ServerDatabaseRename; +use crate::routes::db::ServerDatabaseResource; use crate::server_db::Database; use crate::server_db::ServerDb; use crate::server_error::ServerResponse; use crate::user_id::AdminId; use crate::utilities::db_name; +use crate::utilities::required_role; use agdb_api::DbAudit; +use agdb_api::DbUserRole; use agdb_api::Queries; use agdb_api::QueriesResults; use agdb_api::ServerDatabase; @@ -46,9 +49,9 @@ pub(crate) async fn add( request: Query, ) -> ServerResponse { let name = db_name(&owner, &db); - let user = server_db.user_id(&owner).await?; + let owner_id = server_db.user_id(&owner).await?; - if server_db.find_user_db_id(user, &name).await?.is_some() { + if server_db.find_user_db_id(owner_id, &name).await?.is_some() { return Err(ErrorCode::DbExists.into()); } @@ -58,7 +61,7 @@ pub(crate) async fn add( server_db .insert_db( - user, + owner_id, Database { db_id: None, name, @@ -88,13 +91,18 @@ pub(crate) async fn add( pub(crate) async fn audit( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse<(StatusCode, Json)> { - let owner_id = db_pool.find_user_id(&owner).await?; - let results = db_pool.audit(&owner, &db, owner_id, &config).await?; + let db_name = db_name(&owner, &db); + let owner_id = server_db.user_id(&owner).await?; + server_db.user_db_id(owner_id, &db_name).await?; - Ok((StatusCode::OK, Json(results))) + Ok(( + StatusCode::OK, + Json(db_pool.audit(&owner, &db, &config).await?), + )) } #[utoipa::path(post, @@ -116,15 +124,60 @@ pub(crate) async fn audit( pub(crate) async fn backup( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; - db_pool.backup_db(&owner, &db, owner_id, &config).await?; + let db_name = db_name(&owner, &db); + let owner_id = server_db.user_id(&owner).await?; + let mut database = server_db.user_db(owner_id, &db_name).await?; + + database.backup = db_pool + .backup_db(&owner, &db, &db_name, database.db_type, &config) + .await?; + + server_db.save_db(&database).await?; Ok(StatusCode::CREATED) } +#[utoipa::path(post, + path = "/api/v1/admin/db/{owner}/{db}/clear", + operation_id = "db_clear", + tag = "agdb", + security(("Token" = [])), + params( + ("owner" = String, Path, description = "user name"), + ("db" = String, Path, description = "db name"), + ServerDatabaseResource + ), + responses( + (status = 201, description = "db resource(s) cleared", body = ServerDatabase), + (status = 401, description = "unauthorized"), + (status = 403, description = "server admin only"), + (status = 404, description = "user / db not found"), + ) +)] +pub(crate) async fn clear( + _admin: AdminId, + State(db_pool): State, + State(server_db): State, + State(config): State, + Path((owner, db)): Path<(String, String)>, + request: Query, +) -> ServerResponse<(StatusCode, Json)> { + let db_name = db_name(&owner, &db); + let owner_id = server_db.user_id(&owner).await?; + let mut database = server_db.user_db(owner_id, &db_name).await?; + let role = server_db.user_db_role(owner_id, &db_name).await?; + let db = db_pool + .clear_db(&owner, &db, &mut database, role, &config, request.resource) + .await?; + server_db.save_db(&database).await?; + + Ok((StatusCode::OK, Json(db))) +} + #[utoipa::path(post, path = "/api/v1/admin/db/{owner}/{db}/convert", operation_id = "admin_db_convert", @@ -138,22 +191,40 @@ pub(crate) async fn backup( responses( (status = 201, description = "db typ changes"), (status = 401, description = "unauthorized"), - (status = 403, description = "admin only"), + (status = 403, description = "server admin only"), (status = 404, description = "user / db not found"), ) )] pub(crate) async fn convert( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; + let db_name = db_name(&owner, &db); + let owner_id = server_db.user_id(&owner).await?; + let mut database = server_db.user_db(owner_id, &db_name).await?; + + if database.db_type == request.db_type { + return Ok(StatusCode::CREATED); + } + db_pool - .convert_db(&owner, &db, owner_id, request.db_type, &config) + .convert_db( + &owner, + &db, + &db_name, + database.db_type, + request.db_type, + &config, + ) .await?; + database.db_type = request.db_type; + server_db.save_db(&database).await?; + Ok(StatusCode::CREATED) } @@ -178,13 +249,40 @@ pub(crate) async fn convert( pub(crate) async fn copy( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; + let (new_owner, new_db) = request + .new_name + .split_once('/') + .ok_or(ErrorCode::DbInvalid)?; + let source_db = db_name(&owner, &db); + let target_db = db_name(new_owner, new_db); + let owner_id = server_db.user_id(&owner).await?; + let db_type = server_db.user_db(owner_id, &source_db).await?.db_type; + let new_owner_id = server_db.user_id(new_owner).await?; + + if server_db + .find_user_db_id(new_owner_id, &target_db) + .await? + .is_some() + { + return Err(ErrorCode::DbExists.into()); + } + db_pool - .copy_db(&owner, &db, &request.new_name, owner_id, &config, true) + .copy_db(&source_db, new_owner, new_db, &target_db, &config) + .await?; + + server_db + .save_db(&Database { + db_id: None, + name: target_db, + db_type, + backup: 0, + }) .await?; Ok(StatusCode::CREATED) @@ -208,11 +306,14 @@ pub(crate) async fn copy( pub(crate) async fn delete( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; - db_pool.delete_db(&owner, &db, owner_id, &config).await?; + let owner_id = server_db.user_id(&owner).await?; + let db = db_name(&owner, &db); + server_db.remove_db(owner_id, &db).await?; + db_pool.delete_db(&owner, &db, &db, &config).await?; Ok(StatusCode::NO_CONTENT) } @@ -241,10 +342,16 @@ pub(crate) async fn exec( Path((owner, db)): Path<(String, String)>, Json(queries): Json, ) -> ServerResponse<(StatusCode, Json)> { - let owner_id = db_pool.find_user_id(&owner).await?; - let results = db_pool - .exec(&owner, &db, owner_id, queries, &config) - .await?; + let db_name = db_name(&owner, &db); + let required_role = required_role(&queries); + + let results = if required_role == DbUserRole::Read { + db_pool.exec(&db_name, queries).await? + } else { + db_pool + .exec_mut(&owner, &db, &db_name, &config.admin, queries, &config) + .await? + }; Ok((StatusCode::OK, Json(QueriesResults(results)))) } @@ -262,8 +369,20 @@ pub(crate) async fn exec( pub(crate) async fn list( _admin: AdminId, State(db_pool): State, + State(server_db): State, ) -> ServerResponse<(StatusCode, Json>)> { - let dbs = db_pool.find_dbs().await?; + let databases = server_db.dbs().await?; + let mut dbs = Vec::with_capacity(databases.len()); + + for db in databases { + dbs.push(ServerDatabase { + size: db_pool.db_size(&db.name).await?, + name: db.name, + db_type: db.db_type, + role: DbUserRole::Admin, + backup: db.backup, + }); + } Ok((StatusCode::OK, Json(dbs))) } @@ -285,12 +404,25 @@ pub(crate) async fn list( pub(crate) async fn optimize( _admin: AdminId, State(db_pool): State, + State(server_db): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse<(StatusCode, Json)> { - let owner_id = db_pool.find_user_id(&owner).await?; - let db = db_pool.optimize_db(&owner, &db, owner_id).await?; + let db_name = db_name(&owner, &db); + let owner_id = server_db.user_id(&owner).await?; + let database = server_db.user_db(owner_id, &db_name).await?; + let role = server_db.user_db_role(owner_id, &db_name).await?; + let size = db_pool.optimize_db(&db_name).await?; - Ok((StatusCode::OK, Json(db))) + Ok(( + StatusCode::OK, + Json(ServerDatabase { + name: db_name, + db_type: database.db_type, + role, + backup: database.backup, + size, + }), + )) } #[utoipa::path(delete, @@ -311,10 +443,13 @@ pub(crate) async fn optimize( pub(crate) async fn remove( _admin: AdminId, State(db_pool): State, + State(server_db): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; - db_pool.remove_db(&owner, &db, owner_id).await?; + let db = db_name(&owner, &db); + let owner_id = server_db.user_id(&owner).await?; + server_db.remove_db(owner_id, &db).await?; + db_pool.remove_db(&db).await?; Ok(StatusCode::NO_CONTENT) } @@ -340,15 +475,46 @@ pub(crate) async fn remove( pub(crate) async fn rename( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, request: Query, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; + let db_name = db_name(&owner, &db); + + if db_name == request.new_name { + return Ok(StatusCode::CREATED); + } + + let (new_owner, new_db) = request + .new_name + .split_once('/') + .ok_or(ErrorCode::DbInvalid)?; + let new_owner_id = server_db.user_id(new_owner).await?; + let owner_id = server_db.user_id(&owner).await?; + let mut database = server_db.user_db(owner_id, &db_name).await?; + db_pool - .rename_db(&owner, &db, &request.new_name, owner_id, &config) + .rename_db( + &owner, + &db, + &db_name, + new_owner, + new_db, + &request.new_name, + &config, + ) .await?; + database.name = request.new_name.clone(); + server_db.save_db(&database).await?; + + if new_owner != owner { + server_db + .insert_db_user(database.db_id.unwrap(), new_owner_id, DbUserRole::Admin) + .await?; + } + Ok(StatusCode::CREATED) } @@ -370,11 +536,21 @@ pub(crate) async fn rename( pub(crate) async fn restore( _admin: AdminId, State(db_pool): State, + State(server_db): State, State(config): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - let owner_id = db_pool.find_user_id(&owner).await?; - db_pool.restore_db(&owner, &db, owner_id, &config).await?; + let db_name = db_name(&owner, &db); + let owner_id = server_db.user_id(&owner).await?; + let mut database = server_db.user_db(owner_id, &db_name).await?; + + if let Some(backup) = db_pool + .restore_db(&owner, &db, &db_name, database.db_type, &config) + .await? + { + database.backup = backup; + server_db.save_db(&database).await?; + } Ok(StatusCode::CREATED) } diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs index e0bb7ca2..3b714b1e 100644 --- a/agdb_server/src/server_db.rs +++ b/agdb_server/src/server_db.rs @@ -372,8 +372,7 @@ impl ServerDb { } pub(crate) async fn user(&self, username: &str) -> ServerResult { - Ok(self - .0 + self.0 .read() .await .exec( @@ -383,7 +382,7 @@ impl ServerDb { .query(), )? .try_into() - .map_err(|_| user_not_found(username))?) + .map_err(|_| user_not_found(username)) } pub(crate) async fn user_name(&self, id: DbId) -> ServerResult { @@ -413,8 +412,7 @@ impl ServerDb { } pub(crate) async fn user_db(&self, user: DbId, db: &str) -> ServerResult { - Ok(self - .0 + self.0 .read() .await .exec( @@ -424,14 +422,13 @@ impl ServerDb { .query(), )? .try_into() - .map_err(|_| db_not_found(db))?) + .map_err(|_| db_not_found(db)) } pub(crate) async fn user_db_id(&self, user: DbId, db: &str) -> ServerResult { - Ok(self - .find_user_db_id(user, db) + self.find_user_db_id(user, db) .await? - .ok_or(db_not_found(db))?) + .ok_or(db_not_found(db)) } pub(crate) async fn user_db_role(&self, user: DbId, db: &str) -> ServerResult { From b743ac55b6abb3581cd25e23fe716ed1b40ef4ab Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Mon, 11 Nov 2024 23:39:59 +0100 Subject: [PATCH 15/28] fixes --- agdb_server/backup_test | 0 agdb_server/openapi.json | 4 ++-- agdb_server/src/server_db.rs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) create mode 100644 agdb_server/backup_test diff --git a/agdb_server/backup_test b/agdb_server/backup_test new file mode 100644 index 00000000..e69de29b diff --git a/agdb_server/openapi.json b/agdb_server/openapi.json index 0dfc6e55..4f1c7dcc 100644 --- a/agdb_server/openapi.json +++ b/agdb_server/openapi.json @@ -238,7 +238,7 @@ "description": "unauthorized" }, "403": { - "description": "admin only" + "description": "server admin only" }, "404": { "description": "user / db not found" @@ -1355,7 +1355,7 @@ ], "responses": { "201": { - "description": "db typ changes" + "description": "db type changes" }, "401": { "description": "unauthorized" diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs index 3b714b1e..0a5d16f3 100644 --- a/agdb_server/src/server_db.rs +++ b/agdb_server/src/server_db.rs @@ -51,7 +51,7 @@ const SERVER_DB_FILE: &str = "agdb_server.agdb"; pub(crate) async fn new(config: &Config) -> ServerResult { std::fs::create_dir_all(&config.data_dir)?; - let db_name = format!("mapped:{}/{}", config.data_dir, SERVER_DB_FILE); + let db_name = format!("{}/{}", config.data_dir, SERVER_DB_FILE); let db = ServerDb::new(&db_name)?; let admin = if let Some(admin_id) = db.find_user_id(&config.admin).await? { @@ -87,11 +87,11 @@ impl ServerDb { .map(|kv| kv.key.to_string()) .collect(); - if indexes.iter().any(|i| i == USERNAME) { + if !indexes.iter().any(|i| i == USERNAME) { t.exec_mut(QueryBuilder::insert().index(USERNAME).query())?; } - if indexes.iter().any(|i| i == TOKEN) { + if !indexes.iter().any(|i| i == TOKEN) { t.exec_mut(QueryBuilder::insert().index(TOKEN).query())?; } From 634a463a2c2621b5f0dc6786c63166f64f01b9e0 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Tue, 12 Nov 2024 17:21:57 +0100 Subject: [PATCH 16/28] fix add db --- agdb_server/src/db_pool.rs | 17 +++++++---------- agdb_server/src/routes/admin/db.rs | 2 +- agdb_server/src/routes/db.rs | 2 +- 3 files changed, 9 insertions(+), 12 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index cd52eff0..bd4bdcff 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -7,7 +7,6 @@ use crate::server_db::Database; use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResult; -use crate::utilities::db_name; use agdb::QueryResult; use agdb_api::DbAudit; use agdb_api::DbResource; @@ -60,15 +59,16 @@ impl DbPool { &self, owner: &str, db: &str, + db_name: &str, db_type: DbType, config: &Config, ) -> ServerResult { - let db_name = db_name(owner, db); let db_path = Path::new(&config.data_dir).join(&db_name); - std::fs::create_dir_all(db_audit_dir(owner, config))?; let path = db_path.to_str().ok_or(ErrorCode::DbInvalid)?.to_string(); - let server_db = UserDb::new(&format!("{}:{}", db_type, path)).map_err(|mut e| { + std::fs::create_dir_all(db_audit_dir(owner, config))?; + + let user_db = UserDb::new(&format!("{}:{}", db_type, path)).map_err(|mut e| { e.status = ErrorCode::DbInvalid.into(); e.description = format!("{}: {}", ErrorCode::DbInvalid.as_str(), e.description); e @@ -80,7 +80,7 @@ impl DbPool { 0 }; - self.0.write().await.insert(db_name.clone(), server_db); + self.0.write().await.insert(db_name.to_string(), user_db); Ok(backup) } @@ -275,7 +275,7 @@ impl DbPool { std::fs::create_dir_all(Path::new(&config.data_dir).join(new_owner))?; - let server_db = self + let user_db = self .db(source_db) .await? .copy(target_file.to_string_lossy().as_ref()) @@ -286,10 +286,7 @@ impl DbPool { &format!("db copy error: {}", e.description), ) })?; - self.0 - .write() - .await - .insert(target_db.to_string(), server_db); + self.0.write().await.insert(target_db.to_string(), user_db); Ok(()) } diff --git a/agdb_server/src/routes/admin/db.rs b/agdb_server/src/routes/admin/db.rs index 26b6d1fd..c0f99f87 100644 --- a/agdb_server/src/routes/admin/db.rs +++ b/agdb_server/src/routes/admin/db.rs @@ -56,7 +56,7 @@ pub(crate) async fn add( } let backup = db_pool - .add_db(&owner, &name, request.db_type, &config) + .add_db(&owner, &db, &name, request.db_type, &config) .await?; server_db diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 8a44ff8b..481b71fd 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -87,7 +87,7 @@ pub(crate) async fn add( } let backup = db_pool - .add_db(&owner, &name, request.db_type, &config) + .add_db(&owner, &db, &name, request.db_type, &config) .await?; server_db From eb9fbda8e115cacb2fb6572ab94491b315ebc92a Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Tue, 12 Nov 2024 19:14:43 +0100 Subject: [PATCH 17/28] fixes --- agdb_server/src/db_pool.rs | 2 +- agdb_server/src/routes/admin/db.rs | 12 ++++++------ agdb_server/src/routes/db.rs | 12 ++++++------ agdb_server/src/server_db.rs | 18 ++++++++++++------ 4 files changed, 25 insertions(+), 19 deletions(-) diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index bd4bdcff..1bc790d5 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -63,7 +63,7 @@ impl DbPool { db_type: DbType, config: &Config, ) -> ServerResult { - let db_path = Path::new(&config.data_dir).join(&db_name); + let db_path = Path::new(&config.data_dir).join(db_name); let path = db_path.to_str().ok_or(ErrorCode::DbInvalid)?.to_string(); std::fs::create_dir_all(db_audit_dir(owner, config))?; diff --git a/agdb_server/src/routes/admin/db.rs b/agdb_server/src/routes/admin/db.rs index c0f99f87..d8ba8adb 100644 --- a/agdb_server/src/routes/admin/db.rs +++ b/agdb_server/src/routes/admin/db.rs @@ -311,9 +311,9 @@ pub(crate) async fn delete( Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { let owner_id = server_db.user_id(&owner).await?; - let db = db_name(&owner, &db); - server_db.remove_db(owner_id, &db).await?; - db_pool.delete_db(&owner, &db, &db, &config).await?; + let db_name = db_name(&owner, &db); + server_db.remove_db(owner_id, &db_name).await?; + db_pool.delete_db(&owner, &db, &db_name, &config).await?; Ok(StatusCode::NO_CONTENT) } @@ -446,10 +446,10 @@ pub(crate) async fn remove( State(server_db): State, Path((owner, db)): Path<(String, String)>, ) -> ServerResponse { - let db = db_name(&owner, &db); + let db_name = db_name(&owner, &db); let owner_id = server_db.user_id(&owner).await?; - server_db.remove_db(owner_id, &db).await?; - db_pool.remove_db(&db).await?; + server_db.remove_db(owner_id, &db_name).await?; + db_pool.remove_db(&db_name).await?; Ok(StatusCode::NO_CONTENT) } diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 481b71fd..20ef7cae 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -372,9 +372,9 @@ pub(crate) async fn delete( return Err(permission_denied("owner only")); } - let db = db_name(&owner, &db); - server_db.remove_db(user.0, &db).await?; - db_pool.delete_db(&owner, &db, &db, &config).await?; + let db_name = db_name(&owner, &db); + server_db.remove_db(user.0, &db_name).await?; + db_pool.delete_db(&owner, &db, &db_name, &config).await?; Ok(StatusCode::NO_CONTENT) } @@ -526,9 +526,9 @@ pub(crate) async fn remove( return Err(permission_denied("owner only")); } - let db = db_name(&owner, &db); - server_db.remove_db(user.0, &db).await?; - db_pool.remove_db(&db).await?; + let db_name: String = db_name(&owner, &db); + server_db.remove_db(user.0, &db_name).await?; + db_pool.remove_db(&db_name).await?; Ok(StatusCode::NO_CONTENT) } diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs index 0a5d16f3..d2f940ee 100644 --- a/agdb_server/src/server_db.rs +++ b/agdb_server/src/server_db.rs @@ -298,12 +298,18 @@ impl ServerDb { } pub(crate) async fn remove_db(&self, user: DbId, db: &str) -> ServerResult<()> { - self.0.write().await.exec_mut( - QueryBuilder::remove() - .ids(find_user_db_query(user, db)) - .query(), - )?; - Ok(()) + self.0.write().await.transaction_mut(|t| { + let db_id = t + .exec(find_user_db_query(user, db))? + .elements + .first() + .ok_or(db_not_found(db))? + .id; + + t.exec_mut(QueryBuilder::remove().ids(db_id).query())?; + + Ok(()) + }) } pub(crate) async fn remove_db_user(&self, db: DbId, user: DbId) -> ServerResult<()> { From 9829fb1bb47f9aaa21d9d3c2f8d9a288a1996d9f Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Tue, 12 Nov 2024 19:57:41 +0100 Subject: [PATCH 18/28] fix --- agdb_server/backup_test | 0 agdb_server/src/db_pool/user_db_storage.rs | 3 ++- agdb_server/src/routes/admin/db/user.rs | 3 ++- 3 files changed, 4 insertions(+), 2 deletions(-) delete mode 100644 agdb_server/backup_test diff --git a/agdb_server/backup_test b/agdb_server/backup_test deleted file mode 100644 index e69de29b..00000000 diff --git a/agdb_server/src/db_pool/user_db_storage.rs b/agdb_server/src/db_pool/user_db_storage.rs index 3b239f29..f3199020 100644 --- a/agdb_server/src/db_pool/user_db_storage.rs +++ b/agdb_server/src/db_pool/user_db_storage.rs @@ -194,9 +194,10 @@ mod tests { #[test] fn memory_storage() -> anyhow::Result<()> { + let test_file = TestFile::new("backup_test"); let mut storage = UserDbStorage::new("memory:db_test.agdb")?; let _ = format!("{:?}", storage); - storage.backup("backup_test")?; + storage.backup(&test_file.0)?; let other = storage.copy("db_test_copy.agdb")?; assert_eq!(other.name(), "db_test_copy.agdb"); storage.flush()?; diff --git a/agdb_server/src/routes/admin/db/user.rs b/agdb_server/src/routes/admin/db/user.rs index 9daf80ac..c64badaf 100644 --- a/agdb_server/src/routes/admin/db/user.rs +++ b/agdb_server/src/routes/admin/db/user.rs @@ -39,8 +39,9 @@ pub(crate) async fn add( return Err(permission_denied("cannot change role of db owner")); } + let db_name = db_name(&owner, &db); let owner_id = server_db.user_id(&owner).await?; - let db_id = server_db.user_db_id(owner_id, &db).await?; + let db_id = server_db.user_db_id(owner_id, &db_name).await?; let user_id = server_db.user_id(&username).await?; server_db .insert_db_user(db_id, user_id, request.db_role) From 0d8d809913b3ecb221d4b6858f58f6a69ebd5012 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Tue, 12 Nov 2024 20:04:52 +0100 Subject: [PATCH 19/28] Update server_db.rs --- agdb_server/src/server_db.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/agdb_server/src/server_db.rs b/agdb_server/src/server_db.rs index d2f940ee..9a245d6f 100644 --- a/agdb_server/src/server_db.rs +++ b/agdb_server/src/server_db.rs @@ -287,7 +287,7 @@ impl ServerDb { .to(db) .limit(1) .where_() - .distance(CountComparison::Equal(2)) + .distance(CountComparison::LessThanOrEqual(2)) .and() .key(ROLE) .value(Comparison::Equal(DbUserRole::Admin.into())) From 9503f963bbd8485cc91ae8c109a33db6e185870e Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Tue, 12 Nov 2024 20:14:16 +0100 Subject: [PATCH 20/28] Update db.rs --- agdb_server/src/routes/db.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index 20ef7cae..c8569330 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -314,6 +314,11 @@ pub(crate) async fn copy( let target_db = db_name(new_owner, new_db); let db_type = server_db.user_db(user.0, &source_db).await?.db_type; let username = server_db.user_name(user.0).await?; + let new_owner_id = if username == new_owner { + user.0 + } else { + server_db.user_id(new_owner).await? + }; if new_owner != username { return Err(permission_denied("cannot copy db to another user")); @@ -332,7 +337,7 @@ pub(crate) async fn copy( .await?; server_db - .save_db(&Database { + .insert_db(new_owner_id, Database { db_id: None, name: target_db, db_type, From a3154719addf610932faa78eb59df36dfef4e389 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Tue, 12 Nov 2024 20:55:50 +0100 Subject: [PATCH 21/28] fix --- agdb_server/src/routes/admin/db.rs | 2 +- agdb_server/src/routes/db.rs | 17 ++++++++++------- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/agdb_server/src/routes/admin/db.rs b/agdb_server/src/routes/admin/db.rs index d8ba8adb..8b54bb07 100644 --- a/agdb_server/src/routes/admin/db.rs +++ b/agdb_server/src/routes/admin/db.rs @@ -376,7 +376,7 @@ pub(crate) async fn list( for db in databases { dbs.push(ServerDatabase { - size: db_pool.db_size(&db.name).await?, + size: db_pool.db_size(&db.name).await.unwrap_or(0), name: db.name, db_type: db.db_type, role: DbUserRole::Admin, diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index c8569330..d32eb50b 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -337,12 +337,15 @@ pub(crate) async fn copy( .await?; server_db - .insert_db(new_owner_id, Database { - db_id: None, - name: target_db, - db_type, - backup: 0, - }) + .insert_db( + new_owner_id, + Database { + db_id: None, + name: target_db, + db_type, + backup: 0, + }, + ) .await?; Ok(StatusCode::CREATED) @@ -449,7 +452,7 @@ pub(crate) async fn list( for db in databases { dbs.push(ServerDatabase { - size: db_pool.db_size(&db.1.name).await?, + size: db_pool.db_size(&db.1.name).await.unwrap_or(0), name: db.1.name, db_type: db.1.db_type, role: db.0, From 75e01dda86097ef50165794a290067353bfa069c Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Nov 2024 17:44:22 +0100 Subject: [PATCH 22/28] Update db.rs --- agdb_server/src/routes/db.rs | 32 ++++++++++++++++++++++---------- 1 file changed, 22 insertions(+), 10 deletions(-) diff --git a/agdb_server/src/routes/db.rs b/agdb_server/src/routes/db.rs index d32eb50b..e8ac0551 100644 --- a/agdb_server/src/routes/db.rs +++ b/agdb_server/src/routes/db.rs @@ -448,18 +448,30 @@ pub(crate) async fn list( State(server_db): State, ) -> ServerResponse<(StatusCode, Json>)> { let databases = server_db.user_dbs(user.0).await?; - let mut dbs = Vec::with_capacity(databases.len()); - - for db in databases { - dbs.push(ServerDatabase { - size: db_pool.db_size(&db.1.name).await.unwrap_or(0), - name: db.1.name, - db_type: db.1.db_type, - role: db.0, - backup: db.1.backup, - }); + let mut sizes = Vec::with_capacity(databases.len()); + + for (_, db) in &databases { + sizes.push(db_pool.db_size(&db.name).await.unwrap_or(0)); } + let dbs = databases + .into_iter() + .zip(sizes) + .filter_map(|((role, db), size)| { + if size != 0 { + Some(ServerDatabase { + name: db.name, + db_type: db.db_type, + role, + backup: db.backup, + size, + }) + } else { + None + } + }) + .collect(); + Ok((StatusCode::OK, Json(dbs))) } From c857eb41bd08fac02075b4f6142ad7e6ca1f2ab4 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Nov 2024 18:22:03 +0100 Subject: [PATCH 23/28] add missing tests --- .../tests/routes/admin_db_clear_test.rs | 186 ++++++++++++++++++ agdb_server/tests/routes/mod.rs | 1 + 2 files changed, 187 insertions(+) create mode 100644 agdb_server/tests/routes/admin_db_clear_test.rs diff --git a/agdb_server/tests/routes/admin_db_clear_test.rs b/agdb_server/tests/routes/admin_db_clear_test.rs new file mode 100644 index 00000000..2da99e3c --- /dev/null +++ b/agdb_server/tests/routes/admin_db_clear_test.rs @@ -0,0 +1,186 @@ +use crate::TestServer; +use crate::ADMIN; +use agdb::QueryBuilder; +use agdb_api::DbResource; +use agdb_api::DbType; +use agdb_api::DbUserRole; +use std::path::Path; + +#[tokio::test] +async fn clear_backup() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.user_login(owner, owner).await?; + server.api.db_add(owner, db, DbType::Mapped).await?; + let queries = &vec![QueryBuilder::insert().nodes().count(1).query().into()]; + server.api.db_exec(owner, db, queries).await?; + server.api.db_backup(owner, db).await?; + server.api.user_login(ADMIN, ADMIN).await?; + let (status, db) = server + .api + .admin_db_clear(owner, db, DbResource::Backup) + .await?; + assert_eq!(status, 200); + assert_eq!(db.backup, 0); + Ok(()) +} + +#[tokio::test] +async fn clear_audit() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.user_login(owner, owner).await?; + server.api.db_add(owner, db, DbType::Mapped).await?; + let queries = &vec![QueryBuilder::insert().nodes().count(1).query().into()]; + server.api.db_exec(owner, db, queries).await?; + server.api.user_login(ADMIN, ADMIN).await?; + let (status, _) = server + .api + .admin_db_clear(owner, db, DbResource::Audit) + .await?; + assert_eq!(status, 200); + let db_audit_file = Path::new(&server.data_dir) + .join(owner) + .join("audit") + .join(format!("{}.log", db)); + assert!(!db_audit_file.exists()); + Ok(()) +} + +#[tokio::test] +async fn clear_db() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.user_login(owner, owner).await?; + server.api.db_add(owner, db, DbType::Mapped).await?; + let queries = &vec![QueryBuilder::insert().nodes().count(100).query().into()]; + server.api.db_exec(owner, db, queries).await?; + let (_, list) = server.api.db_list().await?; + let original_size = list[0].size; + server.api.user_login(ADMIN, ADMIN).await?; + let (status, db) = server.api.admin_db_clear(owner, db, DbResource::Db).await?; + assert_eq!(status, 200); + assert!(db.size < original_size); + Ok(()) +} + +#[tokio::test] +async fn clear_db_memory() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.user_login(owner, owner).await?; + server.api.db_add(owner, db, DbType::Memory).await?; + let queries = &vec![QueryBuilder::insert().nodes().count(100).query().into()]; + server.api.db_exec(owner, db, queries).await?; + let (_, list) = server.api.db_list().await?; + let original_size = list[0].size; + server.api.user_login(ADMIN, ADMIN).await?; + let (status, db) = server.api.admin_db_clear(owner, db, DbResource::Db).await?; + assert_eq!(status, 200); + assert!(db.size < original_size); + Ok(()) +} + +#[tokio::test] +async fn clear_db_memory_backup() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.user_login(owner, owner).await?; + server.api.db_add(owner, db, DbType::Memory).await?; + let db_path = Path::new(&server.data_dir).join(owner).join(db); + assert!(!db_path.exists()); + server.api.db_backup(owner, db).await?; + assert!(db_path.exists()); + server.api.user_login(ADMIN, ADMIN).await?; + let (status, db) = server + .api + .admin_db_clear(owner, db, DbResource::Backup) + .await?; + assert!(!db_path.exists()); + assert_eq!(status, 200); + assert_eq!(db.backup, 0); + Ok(()) +} + +#[tokio::test] +async fn clear_all() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.user_login(owner, owner).await?; + server.api.db_add(owner, db, DbType::Mapped).await?; + let queries = &vec![QueryBuilder::insert().nodes().count(100).query().into()]; + server.api.db_exec(owner, db, queries).await?; + let (_, list) = server.api.db_list().await?; + let original_size = list[0].size; + server.api.db_backup(owner, db).await?; + server.api.user_login(ADMIN, ADMIN).await?; + let (status, database) = server + .api + .admin_db_clear(owner, db, DbResource::All) + .await?; + assert_eq!(status, 200); + assert!(database.size < original_size); + let db_audit_file = Path::new(&server.data_dir) + .join(owner) + .join("audit") + .join(format!("{}.log", db)); + assert!(!db_audit_file.exists()); + assert_eq!(database.backup, 0); + Ok(()) +} + +#[tokio::test] +async fn non_admin() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let user = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.admin_user_add(user, user).await?; + server.api.admin_db_add(owner, db, DbType::Memory).await?; + server + .api + .admin_db_user_add(owner, db, user, DbUserRole::Write) + .await?; + server.api.user_login(user, user).await?; + let status = server + .api + .admin_db_clear(owner, db, DbResource::All) + .await + .unwrap_err() + .status; + assert_eq!(status, 401); + Ok(()) +} + +#[tokio::test] +async fn no_token() -> anyhow::Result<()> { + let server = TestServer::new().await?; + let status = server + .api + .admin_db_clear("user", "db", DbResource::All) + .await + .unwrap_err() + .status; + assert_eq!(status, 401); + Ok(()) +} diff --git a/agdb_server/tests/routes/mod.rs b/agdb_server/tests/routes/mod.rs index f83d7267..84bed244 100644 --- a/agdb_server/tests/routes/mod.rs +++ b/agdb_server/tests/routes/mod.rs @@ -1,6 +1,7 @@ mod admin_db_add_test; mod admin_db_audit_test; mod admin_db_backup_restore_test; +mod admin_db_clear_test; mod admin_db_convert_test; mod admin_db_copy_test; mod admin_db_delete_test; From f5fc25032f80d24867b5c63276b90a294d8aa7ec Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Nov 2024 18:28:46 +0100 Subject: [PATCH 24/28] fix api --- agdb_server/openapi.json | 62 ++++++++++++++++++++++++++++++++++++++++ agdb_server/src/api.rs | 1 + 2 files changed, 63 insertions(+) diff --git a/agdb_server/openapi.json b/agdb_server/openapi.json index 4f1c7dcc..749fdde5 100644 --- a/agdb_server/openapi.json +++ b/agdb_server/openapi.json @@ -196,6 +196,68 @@ ] } }, + "/api/v1/admin/db/{owner}/{db}/clear": { + "post": { + "tags": [ + "agdb" + ], + "operationId": "db_clear", + "parameters": [ + { + "name": "owner", + "in": "path", + "description": "user name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "db", + "in": "path", + "description": "db name", + "required": true, + "schema": { + "type": "string" + } + }, + { + "name": "resource", + "in": "query", + "required": true, + "schema": { + "$ref": "#/components/schemas/DbResource" + } + } + ], + "responses": { + "201": { + "description": "db resource(s) cleared", + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/ServerDatabase" + } + } + } + }, + "401": { + "description": "unauthorized" + }, + "403": { + "description": "server admin only" + }, + "404": { + "description": "user / db not found" + } + }, + "security": [ + { + "Token": [] + } + ] + } + }, "/api/v1/admin/db/{owner}/{db}/convert": { "post": { "tags": [ diff --git a/agdb_server/src/api.rs b/agdb_server/src/api.rs index 056a5335..4a905dda 100644 --- a/agdb_server/src/api.rs +++ b/agdb_server/src/api.rs @@ -15,6 +15,7 @@ use utoipa::OpenApi; routes::admin::db::add, routes::admin::db::audit, routes::admin::db::backup, + routes::admin::db::clear, routes::admin::db::convert, routes::admin::db::copy, routes::admin::db::delete, From 707fd8676d4d49421d8464323cb0a727a4bd24a6 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Nov 2024 19:32:49 +0100 Subject: [PATCH 25/28] update coverage --- agdb_api/php/docs/Api/AgdbApi.md | 2633 ---- agdb_api/php/docs/Model/AdminStatus.md | 13 - agdb_api/php/docs/Model/ChangePassword.md | 10 - agdb_api/php/docs/Model/ClusterStatus.md | 13 - agdb_api/php/docs/Model/Comparison.md | 15 - agdb_api/php/docs/Model/ComparisonOneOf.md | 9 - agdb_api/php/docs/Model/ComparisonOneOf1.md | 9 - agdb_api/php/docs/Model/ComparisonOneOf2.md | 9 - agdb_api/php/docs/Model/ComparisonOneOf3.md | 9 - agdb_api/php/docs/Model/ComparisonOneOf4.md | 9 - agdb_api/php/docs/Model/ComparisonOneOf5.md | 9 - agdb_api/php/docs/Model/ComparisonOneOf6.md | 9 - agdb_api/php/docs/Model/CountComparison.md | 14 - .../php/docs/Model/CountComparisonOneOf.md | 9 - .../php/docs/Model/CountComparisonOneOf1.md | 9 - .../php/docs/Model/CountComparisonOneOf2.md | 9 - .../php/docs/Model/CountComparisonOneOf3.md | 9 - .../php/docs/Model/CountComparisonOneOf4.md | 9 - .../php/docs/Model/CountComparisonOneOf5.md | 9 - agdb_api/php/docs/Model/DbElement.md | 12 - agdb_api/php/docs/Model/DbKeyOrder.md | 10 - agdb_api/php/docs/Model/DbKeyOrderOneOf.md | 9 - agdb_api/php/docs/Model/DbKeyOrderOneOf1.md | 9 - agdb_api/php/docs/Model/DbKeyValue.md | 10 - agdb_api/php/docs/Model/DbResource.md | 8 - agdb_api/php/docs/Model/DbType.md | 8 - agdb_api/php/docs/Model/DbTypeParam.md | 9 - agdb_api/php/docs/Model/DbUser.md | 10 - agdb_api/php/docs/Model/DbUserRole.md | 8 - agdb_api/php/docs/Model/DbUserRoleParam.md | 9 - agdb_api/php/docs/Model/DbValue.md | 17 - agdb_api/php/docs/Model/DbValueOneOf.md | 9 - agdb_api/php/docs/Model/DbValueOneOf1.md | 9 - agdb_api/php/docs/Model/DbValueOneOf2.md | 9 - agdb_api/php/docs/Model/DbValueOneOf3.md | 9 - agdb_api/php/docs/Model/DbValueOneOf4.md | 9 - agdb_api/php/docs/Model/DbValueOneOf5.md | 9 - agdb_api/php/docs/Model/DbValueOneOf6.md | 9 - agdb_api/php/docs/Model/DbValueOneOf7.md | 9 - agdb_api/php/docs/Model/DbValueOneOf8.md | 9 - agdb_api/php/docs/Model/InsertAliasesQuery.md | 10 - agdb_api/php/docs/Model/InsertEdgesQuery.md | 13 - agdb_api/php/docs/Model/InsertNodesQuery.md | 12 - agdb_api/php/docs/Model/InsertValuesQuery.md | 10 - agdb_api/php/docs/Model/QueryAudit.md | 11 - agdb_api/php/docs/Model/QueryCondition.md | 11 - agdb_api/php/docs/Model/QueryConditionData.md | 16 - .../php/docs/Model/QueryConditionDataOneOf.md | 9 - .../docs/Model/QueryConditionDataOneOf1.md | 9 - .../docs/Model/QueryConditionDataOneOf2.md | 9 - .../docs/Model/QueryConditionDataOneOf3.md | 9 - .../docs/Model/QueryConditionDataOneOf4.md | 9 - .../docs/Model/QueryConditionDataOneOf5.md | 9 - .../Model/QueryConditionDataOneOf5KeyValue.md | 10 - .../docs/Model/QueryConditionDataOneOf6.md | 9 - .../docs/Model/QueryConditionDataOneOf7.md | 9 - .../php/docs/Model/QueryConditionLogic.md | 8 - .../php/docs/Model/QueryConditionModifier.md | 8 - agdb_api/php/docs/Model/QueryId.md | 10 - agdb_api/php/docs/Model/QueryIdOneOf.md | 9 - agdb_api/php/docs/Model/QueryIdOneOf1.md | 9 - agdb_api/php/docs/Model/QueryIds.md | 10 - agdb_api/php/docs/Model/QueryIdsOneOf.md | 9 - agdb_api/php/docs/Model/QueryIdsOneOf1.md | 9 - agdb_api/php/docs/Model/QueryResult.md | 10 - agdb_api/php/docs/Model/QueryType.md | 26 - agdb_api/php/docs/Model/QueryTypeOneOf.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf1.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf10.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf11.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf12.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf13.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf14.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf15.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf16.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf2.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf3.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf4.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf5.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf6.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf7.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf8.md | 9 - agdb_api/php/docs/Model/QueryTypeOneOf9.md | 9 - agdb_api/php/docs/Model/QueryValues.md | 10 - agdb_api/php/docs/Model/QueryValuesOneOf.md | 9 - agdb_api/php/docs/Model/QueryValuesOneOf1.md | 9 - agdb_api/php/docs/Model/SearchQuery.md | 15 - .../php/docs/Model/SearchQueryAlgorithm.md | 8 - .../php/docs/Model/SelectEdgeCountQuery.md | 11 - agdb_api/php/docs/Model/SelectValuesQuery.md | 10 - agdb_api/php/docs/Model/ServerDatabase.md | 13 - .../php/docs/Model/ServerDatabaseRename.md | 9 - .../php/docs/Model/ServerDatabaseResource.md | 9 - agdb_api/php/docs/Model/UserCredentials.md | 9 - agdb_api/php/docs/Model/UserLogin.md | 10 - agdb_api/php/docs/Model/UserStatus.md | 11 - agdb_api/php/lib/Api/AgdbApi.php | 11964 ---------------- agdb_api/php/lib/ApiException.php | 119 - agdb_api/php/lib/Configuration.php | 532 - agdb_api/php/lib/HeaderSelector.php | 273 - agdb_api/php/lib/Model/AdminStatus.php | 605 - agdb_api/php/lib/Model/ChangePassword.php | 449 - agdb_api/php/lib/Model/ClusterStatus.php | 578 - agdb_api/php/lib/Model/Comparison.php | 635 - agdb_api/php/lib/Model/ComparisonOneOf.php | 412 - agdb_api/php/lib/Model/ComparisonOneOf1.php | 412 - agdb_api/php/lib/Model/ComparisonOneOf2.php | 412 - agdb_api/php/lib/Model/ComparisonOneOf3.php | 412 - agdb_api/php/lib/Model/ComparisonOneOf4.php | 412 - agdb_api/php/lib/Model/ComparisonOneOf5.php | 412 - agdb_api/php/lib/Model/ComparisonOneOf6.php | 412 - agdb_api/php/lib/Model/CountComparison.php | 652 - .../php/lib/Model/CountComparisonOneOf.php | 421 - .../php/lib/Model/CountComparisonOneOf1.php | 421 - .../php/lib/Model/CountComparisonOneOf2.php | 421 - .../php/lib/Model/CountComparisonOneOf3.php | 421 - .../php/lib/Model/CountComparisonOneOf4.php | 421 - .../php/lib/Model/CountComparisonOneOf5.php | 421 - agdb_api/php/lib/Model/DbElement.php | 532 - agdb_api/php/lib/Model/DbKeyOrder.php | 450 - agdb_api/php/lib/Model/DbKeyOrderOneOf.php | 412 - agdb_api/php/lib/Model/DbKeyOrderOneOf1.php | 412 - agdb_api/php/lib/Model/DbKeyValue.php | 450 - agdb_api/php/lib/Model/DbResource.php | 68 - agdb_api/php/lib/Model/DbType.php | 65 - agdb_api/php/lib/Model/DbTypeParam.php | 412 - agdb_api/php/lib/Model/DbUser.php | 449 - agdb_api/php/lib/Model/DbUserRole.php | 65 - agdb_api/php/lib/Model/DbUserRoleParam.php | 412 - agdb_api/php/lib/Model/DbValue.php | 718 - agdb_api/php/lib/Model/DbValueOneOf.php | 412 - agdb_api/php/lib/Model/DbValueOneOf1.php | 412 - agdb_api/php/lib/Model/DbValueOneOf2.php | 421 - agdb_api/php/lib/Model/DbValueOneOf3.php | 412 - agdb_api/php/lib/Model/DbValueOneOf4.php | 412 - agdb_api/php/lib/Model/DbValueOneOf5.php | 412 - agdb_api/php/lib/Model/DbValueOneOf6.php | 412 - agdb_api/php/lib/Model/DbValueOneOf7.php | 412 - agdb_api/php/lib/Model/DbValueOneOf8.php | 412 - agdb_api/php/lib/Model/InsertAliasesQuery.php | 450 - agdb_api/php/lib/Model/InsertEdgesQuery.php | 561 - agdb_api/php/lib/Model/InsertNodesQuery.php | 533 - agdb_api/php/lib/Model/InsertValuesQuery.php | 450 - agdb_api/php/lib/Model/ModelInterface.php | 111 - agdb_api/php/lib/Model/QueryAudit.php | 495 - agdb_api/php/lib/Model/QueryCondition.php | 487 - agdb_api/php/lib/Model/QueryConditionData.php | 672 - .../php/lib/Model/QueryConditionDataOneOf.php | 412 - .../lib/Model/QueryConditionDataOneOf1.php | 412 - .../lib/Model/QueryConditionDataOneOf2.php | 412 - .../lib/Model/QueryConditionDataOneOf3.php | 412 - .../lib/Model/QueryConditionDataOneOf4.php | 412 - .../lib/Model/QueryConditionDataOneOf5.php | 412 - .../QueryConditionDataOneOf5KeyValue.php | 450 - .../lib/Model/QueryConditionDataOneOf6.php | 412 - .../lib/Model/QueryConditionDataOneOf7.php | 412 - .../php/lib/Model/QueryConditionLogic.php | 63 - .../php/lib/Model/QueryConditionModifier.php | 69 - agdb_api/php/lib/Model/QueryId.php | 450 - agdb_api/php/lib/Model/QueryIdOneOf.php | 412 - agdb_api/php/lib/Model/QueryIdOneOf1.php | 412 - agdb_api/php/lib/Model/QueryIds.php | 450 - agdb_api/php/lib/Model/QueryIdsOneOf.php | 412 - agdb_api/php/lib/Model/QueryIdsOneOf1.php | 412 - agdb_api/php/lib/Model/QueryResult.php | 450 - agdb_api/php/lib/Model/QueryType.php | 1042 -- agdb_api/php/lib/Model/QueryTypeOneOf.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf1.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf10.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf11.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf12.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf13.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf14.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf15.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf16.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf2.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf3.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf4.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf5.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf6.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf7.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf8.php | 412 - agdb_api/php/lib/Model/QueryTypeOneOf9.php | 412 - agdb_api/php/lib/Model/QueryValues.php | 450 - agdb_api/php/lib/Model/QueryValuesOneOf.php | 412 - agdb_api/php/lib/Model/QueryValuesOneOf1.php | 412 - agdb_api/php/lib/Model/SearchQuery.php | 653 - .../php/lib/Model/SearchQueryAlgorithm.php | 69 - .../php/lib/Model/SelectEdgeCountQuery.php | 487 - agdb_api/php/lib/Model/SelectValuesQuery.php | 450 - agdb_api/php/lib/Model/ServerDatabase.php | 578 - .../php/lib/Model/ServerDatabaseRename.php | 412 - .../php/lib/Model/ServerDatabaseResource.php | 412 - agdb_api/php/lib/Model/UserCredentials.php | 412 - agdb_api/php/lib/Model/UserLogin.php | 449 - agdb_api/php/lib/Model/UserStatus.php | 486 - agdb_api/php/lib/ObjectSerializer.php | 617 - agdb_api/typescript/src/openapi.d.ts | 18 + agdb_server/src/config.rs | 35 +- agdb_server/src/db_pool.rs | 74 +- agdb_server/src/utilities.rs | 23 + agdb_server/tests/cluster/cluster_test.rs | 17 + 202 files changed, 106 insertions(+), 57994 deletions(-) delete mode 100644 agdb_api/php/docs/Api/AgdbApi.md delete mode 100644 agdb_api/php/docs/Model/AdminStatus.md delete mode 100644 agdb_api/php/docs/Model/ChangePassword.md delete mode 100644 agdb_api/php/docs/Model/ClusterStatus.md delete mode 100644 agdb_api/php/docs/Model/Comparison.md delete mode 100644 agdb_api/php/docs/Model/ComparisonOneOf.md delete mode 100644 agdb_api/php/docs/Model/ComparisonOneOf1.md delete mode 100644 agdb_api/php/docs/Model/ComparisonOneOf2.md delete mode 100644 agdb_api/php/docs/Model/ComparisonOneOf3.md delete mode 100644 agdb_api/php/docs/Model/ComparisonOneOf4.md delete mode 100644 agdb_api/php/docs/Model/ComparisonOneOf5.md delete mode 100644 agdb_api/php/docs/Model/ComparisonOneOf6.md delete mode 100644 agdb_api/php/docs/Model/CountComparison.md delete mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf.md delete mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf1.md delete mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf2.md delete mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf3.md delete mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf4.md delete mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf5.md delete mode 100644 agdb_api/php/docs/Model/DbElement.md delete mode 100644 agdb_api/php/docs/Model/DbKeyOrder.md delete mode 100644 agdb_api/php/docs/Model/DbKeyOrderOneOf.md delete mode 100644 agdb_api/php/docs/Model/DbKeyOrderOneOf1.md delete mode 100644 agdb_api/php/docs/Model/DbKeyValue.md delete mode 100644 agdb_api/php/docs/Model/DbResource.md delete mode 100644 agdb_api/php/docs/Model/DbType.md delete mode 100644 agdb_api/php/docs/Model/DbTypeParam.md delete mode 100644 agdb_api/php/docs/Model/DbUser.md delete mode 100644 agdb_api/php/docs/Model/DbUserRole.md delete mode 100644 agdb_api/php/docs/Model/DbUserRoleParam.md delete mode 100644 agdb_api/php/docs/Model/DbValue.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf1.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf2.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf3.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf4.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf5.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf6.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf7.md delete mode 100644 agdb_api/php/docs/Model/DbValueOneOf8.md delete mode 100644 agdb_api/php/docs/Model/InsertAliasesQuery.md delete mode 100644 agdb_api/php/docs/Model/InsertEdgesQuery.md delete mode 100644 agdb_api/php/docs/Model/InsertNodesQuery.md delete mode 100644 agdb_api/php/docs/Model/InsertValuesQuery.md delete mode 100644 agdb_api/php/docs/Model/QueryAudit.md delete mode 100644 agdb_api/php/docs/Model/QueryCondition.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionData.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf1.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf2.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf3.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf4.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf5.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf6.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf7.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionLogic.md delete mode 100644 agdb_api/php/docs/Model/QueryConditionModifier.md delete mode 100644 agdb_api/php/docs/Model/QueryId.md delete mode 100644 agdb_api/php/docs/Model/QueryIdOneOf.md delete mode 100644 agdb_api/php/docs/Model/QueryIdOneOf1.md delete mode 100644 agdb_api/php/docs/Model/QueryIds.md delete mode 100644 agdb_api/php/docs/Model/QueryIdsOneOf.md delete mode 100644 agdb_api/php/docs/Model/QueryIdsOneOf1.md delete mode 100644 agdb_api/php/docs/Model/QueryResult.md delete mode 100644 agdb_api/php/docs/Model/QueryType.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf1.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf10.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf11.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf12.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf13.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf14.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf15.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf16.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf2.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf3.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf4.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf5.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf6.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf7.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf8.md delete mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf9.md delete mode 100644 agdb_api/php/docs/Model/QueryValues.md delete mode 100644 agdb_api/php/docs/Model/QueryValuesOneOf.md delete mode 100644 agdb_api/php/docs/Model/QueryValuesOneOf1.md delete mode 100644 agdb_api/php/docs/Model/SearchQuery.md delete mode 100644 agdb_api/php/docs/Model/SearchQueryAlgorithm.md delete mode 100644 agdb_api/php/docs/Model/SelectEdgeCountQuery.md delete mode 100644 agdb_api/php/docs/Model/SelectValuesQuery.md delete mode 100644 agdb_api/php/docs/Model/ServerDatabase.md delete mode 100644 agdb_api/php/docs/Model/ServerDatabaseRename.md delete mode 100644 agdb_api/php/docs/Model/ServerDatabaseResource.md delete mode 100644 agdb_api/php/docs/Model/UserCredentials.md delete mode 100644 agdb_api/php/docs/Model/UserLogin.md delete mode 100644 agdb_api/php/docs/Model/UserStatus.md delete mode 100644 agdb_api/php/lib/Api/AgdbApi.php delete mode 100644 agdb_api/php/lib/ApiException.php delete mode 100644 agdb_api/php/lib/Configuration.php delete mode 100644 agdb_api/php/lib/HeaderSelector.php delete mode 100644 agdb_api/php/lib/Model/AdminStatus.php delete mode 100644 agdb_api/php/lib/Model/ChangePassword.php delete mode 100644 agdb_api/php/lib/Model/ClusterStatus.php delete mode 100644 agdb_api/php/lib/Model/Comparison.php delete mode 100644 agdb_api/php/lib/Model/ComparisonOneOf.php delete mode 100644 agdb_api/php/lib/Model/ComparisonOneOf1.php delete mode 100644 agdb_api/php/lib/Model/ComparisonOneOf2.php delete mode 100644 agdb_api/php/lib/Model/ComparisonOneOf3.php delete mode 100644 agdb_api/php/lib/Model/ComparisonOneOf4.php delete mode 100644 agdb_api/php/lib/Model/ComparisonOneOf5.php delete mode 100644 agdb_api/php/lib/Model/ComparisonOneOf6.php delete mode 100644 agdb_api/php/lib/Model/CountComparison.php delete mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf.php delete mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf1.php delete mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf2.php delete mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf3.php delete mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf4.php delete mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf5.php delete mode 100644 agdb_api/php/lib/Model/DbElement.php delete mode 100644 agdb_api/php/lib/Model/DbKeyOrder.php delete mode 100644 agdb_api/php/lib/Model/DbKeyOrderOneOf.php delete mode 100644 agdb_api/php/lib/Model/DbKeyOrderOneOf1.php delete mode 100644 agdb_api/php/lib/Model/DbKeyValue.php delete mode 100644 agdb_api/php/lib/Model/DbResource.php delete mode 100644 agdb_api/php/lib/Model/DbType.php delete mode 100644 agdb_api/php/lib/Model/DbTypeParam.php delete mode 100644 agdb_api/php/lib/Model/DbUser.php delete mode 100644 agdb_api/php/lib/Model/DbUserRole.php delete mode 100644 agdb_api/php/lib/Model/DbUserRoleParam.php delete mode 100644 agdb_api/php/lib/Model/DbValue.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf1.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf2.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf3.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf4.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf5.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf6.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf7.php delete mode 100644 agdb_api/php/lib/Model/DbValueOneOf8.php delete mode 100644 agdb_api/php/lib/Model/InsertAliasesQuery.php delete mode 100644 agdb_api/php/lib/Model/InsertEdgesQuery.php delete mode 100644 agdb_api/php/lib/Model/InsertNodesQuery.php delete mode 100644 agdb_api/php/lib/Model/InsertValuesQuery.php delete mode 100644 agdb_api/php/lib/Model/ModelInterface.php delete mode 100644 agdb_api/php/lib/Model/QueryAudit.php delete mode 100644 agdb_api/php/lib/Model/QueryCondition.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionData.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf1.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf2.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf3.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf4.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf5.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf6.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf7.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionLogic.php delete mode 100644 agdb_api/php/lib/Model/QueryConditionModifier.php delete mode 100644 agdb_api/php/lib/Model/QueryId.php delete mode 100644 agdb_api/php/lib/Model/QueryIdOneOf.php delete mode 100644 agdb_api/php/lib/Model/QueryIdOneOf1.php delete mode 100644 agdb_api/php/lib/Model/QueryIds.php delete mode 100644 agdb_api/php/lib/Model/QueryIdsOneOf.php delete mode 100644 agdb_api/php/lib/Model/QueryIdsOneOf1.php delete mode 100644 agdb_api/php/lib/Model/QueryResult.php delete mode 100644 agdb_api/php/lib/Model/QueryType.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf1.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf10.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf11.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf12.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf13.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf14.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf15.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf16.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf2.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf3.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf4.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf5.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf6.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf7.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf8.php delete mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf9.php delete mode 100644 agdb_api/php/lib/Model/QueryValues.php delete mode 100644 agdb_api/php/lib/Model/QueryValuesOneOf.php delete mode 100644 agdb_api/php/lib/Model/QueryValuesOneOf1.php delete mode 100644 agdb_api/php/lib/Model/SearchQuery.php delete mode 100644 agdb_api/php/lib/Model/SearchQueryAlgorithm.php delete mode 100644 agdb_api/php/lib/Model/SelectEdgeCountQuery.php delete mode 100644 agdb_api/php/lib/Model/SelectValuesQuery.php delete mode 100644 agdb_api/php/lib/Model/ServerDatabase.php delete mode 100644 agdb_api/php/lib/Model/ServerDatabaseRename.php delete mode 100644 agdb_api/php/lib/Model/ServerDatabaseResource.php delete mode 100644 agdb_api/php/lib/Model/UserCredentials.php delete mode 100644 agdb_api/php/lib/Model/UserLogin.php delete mode 100644 agdb_api/php/lib/Model/UserStatus.php delete mode 100644 agdb_api/php/lib/ObjectSerializer.php diff --git a/agdb_api/php/docs/Api/AgdbApi.md b/agdb_api/php/docs/Api/AgdbApi.md deleted file mode 100644 index c2388fe1..00000000 --- a/agdb_api/php/docs/Api/AgdbApi.md +++ /dev/null @@ -1,2633 +0,0 @@ -# Agnesoft\AgdbApi\AgdbApi - -All URIs are relative to http://localhost:3000, except if the operation defines another base path. - -| Method | HTTP request | Description | -| ------------- | ------------- | ------------- | -| [**adminDbAdd()**](AgdbApi.md#adminDbAdd) | **POST** /api/v1/admin/db/{owner}/{db}/add | | -| [**adminDbAudit()**](AgdbApi.md#adminDbAudit) | **GET** /api/v1/admin/db/{owner}/{db}/audit | | -| [**adminDbBackup()**](AgdbApi.md#adminDbBackup) | **POST** /api/v1/admin/db/{owner}/{db}/backup | | -| [**adminDbConvert()**](AgdbApi.md#adminDbConvert) | **POST** /api/v1/admin/db/{owner}/{db}/convert | | -| [**adminDbCopy()**](AgdbApi.md#adminDbCopy) | **POST** /api/v1/admin/db/{owner}/{db}/copy | | -| [**adminDbDelete()**](AgdbApi.md#adminDbDelete) | **DELETE** /api/v1/admin/db/{owner}/{db}/delete | | -| [**adminDbExec()**](AgdbApi.md#adminDbExec) | **POST** /api/v1/admin/db/{owner}/{db}/exec | | -| [**adminDbList()**](AgdbApi.md#adminDbList) | **GET** /api/v1/admin/db/list | | -| [**adminDbOptimize()**](AgdbApi.md#adminDbOptimize) | **POST** /api/v1/admin/db/{owner}/{db}/optimize | | -| [**adminDbRemove()**](AgdbApi.md#adminDbRemove) | **DELETE** /api/v1/admin/db/{owner}/{db}/remove | | -| [**adminDbRename()**](AgdbApi.md#adminDbRename) | **POST** /api/v1/admin/db/{owner}/{db}/rename | | -| [**adminDbRestore()**](AgdbApi.md#adminDbRestore) | **POST** /api/v1/db/admin/{owner}/{db}/restore | | -| [**adminDbUserAdd()**](AgdbApi.md#adminDbUserAdd) | **PUT** /api/v1/admin/db/{owner}/{db}/user/{username}/add | | -| [**adminDbUserList()**](AgdbApi.md#adminDbUserList) | **GET** /api/v1/admin/db/{owner}/{db}/user/list | | -| [**adminDbUserRemove()**](AgdbApi.md#adminDbUserRemove) | **DELETE** /api/v1/admin/db/{owner}/{db}/user/{username}/remove | | -| [**adminShutdown()**](AgdbApi.md#adminShutdown) | **POST** /api/v1/admin/shutdown | | -| [**adminStatus()**](AgdbApi.md#adminStatus) | **GET** /api/v1/admin/status | | -| [**adminUserAdd()**](AgdbApi.md#adminUserAdd) | **POST** /api/v1/admin/user/{username}/add | | -| [**adminUserChangePassword()**](AgdbApi.md#adminUserChangePassword) | **PUT** /api/v1/admin/user/{username}/change_password | | -| [**adminUserList()**](AgdbApi.md#adminUserList) | **GET** /api/v1/admin/user/list | | -| [**adminUserLogout()**](AgdbApi.md#adminUserLogout) | **POST** /api/v1/admin/user/{username}/logout | | -| [**adminUserRemove()**](AgdbApi.md#adminUserRemove) | **DELETE** /api/v1/admin/user/{username}/remove | | -| [**clusterStatus()**](AgdbApi.md#clusterStatus) | **GET** /api/v1/cluster/status | | -| [**dbAdd()**](AgdbApi.md#dbAdd) | **POST** /api/v1/db/{owner}/{db}/add | | -| [**dbAudit()**](AgdbApi.md#dbAudit) | **GET** /api/v1/db/{owner}/{db}/audit | | -| [**dbBackup()**](AgdbApi.md#dbBackup) | **POST** /api/v1/db/{owner}/{db}/backup | | -| [**dbClear()**](AgdbApi.md#dbClear) | **POST** /api/v1/db/{owner}/{db}/clear | | -| [**dbConvert()**](AgdbApi.md#dbConvert) | **POST** /api/v1/db/{owner}/{db}/convert | | -| [**dbCopy()**](AgdbApi.md#dbCopy) | **POST** /api/v1/db/{owner}/{db}/copy | | -| [**dbDelete()**](AgdbApi.md#dbDelete) | **DELETE** /api/v1/db/{owner}/{db}/delete | | -| [**dbExec()**](AgdbApi.md#dbExec) | **POST** /api/v1/db/{owner}/{db}/exec | | -| [**dbList()**](AgdbApi.md#dbList) | **GET** /api/v1/db/list | | -| [**dbOptimize()**](AgdbApi.md#dbOptimize) | **POST** /api/v1/db/{owner}/{db}/optimize | | -| [**dbRemove()**](AgdbApi.md#dbRemove) | **DELETE** /api/v1/db/{owner}/{db}/remove | | -| [**dbRename()**](AgdbApi.md#dbRename) | **POST** /api/v1/db/{owner}/{db}/rename | | -| [**dbRestore()**](AgdbApi.md#dbRestore) | **POST** /api/v1/db/{owner}/{db}/restore | | -| [**dbUserAdd()**](AgdbApi.md#dbUserAdd) | **PUT** /api/v1/db/{owner}/{db}/user/{username}/add | | -| [**dbUserList()**](AgdbApi.md#dbUserList) | **GET** /api/v1/db/{owner}/{db}/user/list | | -| [**dbUserRemove()**](AgdbApi.md#dbUserRemove) | **POST** /api/v1/db/{owner}/{db}/user/{username}/remove | | -| [**status()**](AgdbApi.md#status) | **GET** /api/v1/status | | -| [**userChangePassword()**](AgdbApi.md#userChangePassword) | **PUT** /api/v1/user/change_password | | -| [**userLogin()**](AgdbApi.md#userLogin) | **POST** /api/v1/user/login | | -| [**userLogout()**](AgdbApi.md#userLogout) | **POST** /api/v1/user/logout | | -| [**userStatus()**](AgdbApi.md#userStatus) | **GET** /api/v1/user/status | | - - -## `adminDbAdd()` - -```php -adminDbAdd($owner, $db, $db_type) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name -$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType - -try { - $apiInstance->adminDbAdd($owner, $db, $db_type); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbAdd: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | -| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbAudit()` - -```php -adminDbAudit($owner, $db): \Agnesoft\AgdbApi\Model\QueryAudit[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $result = $apiInstance->adminDbAudit($owner, $db); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbAudit: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\QueryAudit[]**](../Model/QueryAudit.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbBackup()` - -```php -adminDbBackup($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->adminDbBackup($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbBackup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbConvert()` - -```php -adminDbConvert($owner, $db, $db_type) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name -$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType - -try { - $apiInstance->adminDbConvert($owner, $db, $db_type); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbConvert: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | -| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbCopy()` - -```php -adminDbCopy($owner, $db, $new_name) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$new_name = 'new_name_example'; // string - -try { - $apiInstance->adminDbCopy($owner, $db, $new_name); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbCopy: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **new_name** | **string**| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbDelete()` - -```php -adminDbDelete($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->adminDbDelete($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbDelete: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbExec()` - -```php -adminDbExec($owner, $db, $query_type): \Agnesoft\AgdbApi\Model\QueryResult[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$query_type = array(new \Agnesoft\AgdbApi\Model\QueryType()); // \Agnesoft\AgdbApi\Model\QueryType[] - -try { - $result = $apiInstance->adminDbExec($owner, $db, $query_type); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbExec: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **query_type** | [**\Agnesoft\AgdbApi\Model\QueryType[]**](../Model/QueryType.md)| | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\QueryResult[]**](../Model/QueryResult.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbList()` - -```php -adminDbList(): \Agnesoft\AgdbApi\Model\ServerDatabase[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->adminDbList(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbList: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Agnesoft\AgdbApi\Model\ServerDatabase[]**](../Model/ServerDatabase.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbOptimize()` - -```php -adminDbOptimize($owner, $db): \Agnesoft\AgdbApi\Model\ServerDatabase -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $result = $apiInstance->adminDbOptimize($owner, $db); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbOptimize: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\ServerDatabase**](../Model/ServerDatabase.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbRemove()` - -```php -adminDbRemove($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->adminDbRemove($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbRemove: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbRename()` - -```php -adminDbRename($owner, $db, $new_name) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$new_name = 'new_name_example'; // string - -try { - $apiInstance->adminDbRename($owner, $db, $new_name); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbRename: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **new_name** | **string**| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbRestore()` - -```php -adminDbRestore($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->adminDbRestore($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbRestore: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbUserAdd()` - -```php -adminDbUserAdd($owner, $db, $username, $db_role) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$username = 'username_example'; // string | user name -$db_role = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbUserRole(); // \Agnesoft\AgdbApi\Model\DbUserRole - -try { - $apiInstance->adminDbUserAdd($owner, $db, $username, $db_role); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbUserAdd: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **username** | **string**| user name | | -| **db_role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](../Model/.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbUserList()` - -```php -adminDbUserList($owner, $db): \Agnesoft\AgdbApi\Model\DbUser[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name - -try { - $result = $apiInstance->adminDbUserList($owner, $db); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbUserList: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\DbUser[]**](../Model/DbUser.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminDbUserRemove()` - -```php -adminDbUserRemove($owner, $db, $username) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$username = 'username_example'; // string | user name - -try { - $apiInstance->adminDbUserRemove($owner, $db, $username); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminDbUserRemove: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **username** | **string**| user name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminShutdown()` - -```php -adminShutdown() -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $apiInstance->adminShutdown(); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminShutdown: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminStatus()` - -```php -adminStatus(): \Agnesoft\AgdbApi\Model\AdminStatus -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->adminStatus(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminStatus: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Agnesoft\AgdbApi\Model\AdminStatus**](../Model/AdminStatus.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminUserAdd()` - -```php -adminUserAdd($username, $user_credentials) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$username = 'username_example'; // string | desired user name -$user_credentials = new \Agnesoft\AgdbApi\Model\UserCredentials(); // \Agnesoft\AgdbApi\Model\UserCredentials - -try { - $apiInstance->adminUserAdd($username, $user_credentials); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminUserAdd: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **username** | **string**| desired user name | | -| **user_credentials** | [**\Agnesoft\AgdbApi\Model\UserCredentials**](../Model/UserCredentials.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminUserChangePassword()` - -```php -adminUserChangePassword($username, $user_credentials) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$username = 'username_example'; // string | user name -$user_credentials = new \Agnesoft\AgdbApi\Model\UserCredentials(); // \Agnesoft\AgdbApi\Model\UserCredentials - -try { - $apiInstance->adminUserChangePassword($username, $user_credentials); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminUserChangePassword: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **username** | **string**| user name | | -| **user_credentials** | [**\Agnesoft\AgdbApi\Model\UserCredentials**](../Model/UserCredentials.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminUserList()` - -```php -adminUserList(): \Agnesoft\AgdbApi\Model\UserStatus[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->adminUserList(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminUserList: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Agnesoft\AgdbApi\Model\UserStatus[]**](../Model/UserStatus.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminUserLogout()` - -```php -adminUserLogout($username) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$username = 'username_example'; // string | user name - -try { - $apiInstance->adminUserLogout($username); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminUserLogout: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **username** | **string**| user name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `adminUserRemove()` - -```php -adminUserRemove($username): \Agnesoft\AgdbApi\Model\UserStatus[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$username = 'username_example'; // string | user name - -try { - $result = $apiInstance->adminUserRemove($username); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->adminUserRemove: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **username** | **string**| user name | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\UserStatus[]**](../Model/UserStatus.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `clusterStatus()` - -```php -clusterStatus(): \Agnesoft\AgdbApi\Model\ClusterStatus[] -``` - - - -### Example - -```php -clusterStatus(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->clusterStatus: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Agnesoft\AgdbApi\Model\ClusterStatus[]**](../Model/ClusterStatus.md) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbAdd()` - -```php -dbAdd($owner, $db, $db_type) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name -$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType - -try { - $apiInstance->dbAdd($owner, $db, $db_type); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbAdd: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | -| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbAudit()` - -```php -dbAudit($owner, $db): \Agnesoft\AgdbApi\Model\QueryAudit[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $result = $apiInstance->dbAudit($owner, $db); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbAudit: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\QueryAudit[]**](../Model/QueryAudit.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbBackup()` - -```php -dbBackup($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->dbBackup($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbBackup: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbClear()` - -```php -dbClear($owner, $db, $resource): \Agnesoft\AgdbApi\Model\ServerDatabase -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name -$resource = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbResource(); // \Agnesoft\AgdbApi\Model\DbResource - -try { - $result = $apiInstance->dbClear($owner, $db, $resource); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbClear: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | -| **resource** | [**\Agnesoft\AgdbApi\Model\DbResource**](../Model/.md)| | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\ServerDatabase**](../Model/ServerDatabase.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbConvert()` - -```php -dbConvert($owner, $db, $db_type) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name -$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType - -try { - $apiInstance->dbConvert($owner, $db, $db_type); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbConvert: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | -| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbCopy()` - -```php -dbCopy($owner, $db, $new_name) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$new_name = 'new_name_example'; // string - -try { - $apiInstance->dbCopy($owner, $db, $new_name); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbCopy: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **new_name** | **string**| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbDelete()` - -```php -dbDelete($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->dbDelete($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbDelete: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbExec()` - -```php -dbExec($owner, $db, $query_type): \Agnesoft\AgdbApi\Model\QueryResult[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$query_type = array(new \Agnesoft\AgdbApi\Model\QueryType()); // \Agnesoft\AgdbApi\Model\QueryType[] - -try { - $result = $apiInstance->dbExec($owner, $db, $query_type); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbExec: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **query_type** | [**\Agnesoft\AgdbApi\Model\QueryType[]**](../Model/QueryType.md)| | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\QueryResult[]**](../Model/QueryResult.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbList()` - -```php -dbList(): \Agnesoft\AgdbApi\Model\ServerDatabase[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->dbList(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbList: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Agnesoft\AgdbApi\Model\ServerDatabase[]**](../Model/ServerDatabase.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbOptimize()` - -```php -dbOptimize($owner, $db): \Agnesoft\AgdbApi\Model\ServerDatabase -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $result = $apiInstance->dbOptimize($owner, $db); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbOptimize: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\ServerDatabase**](../Model/ServerDatabase.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbRemove()` - -```php -dbRemove($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->dbRemove($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbRemove: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbRename()` - -```php -dbRename($owner, $db, $new_name) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$new_name = 'new_name_example'; // string - -try { - $apiInstance->dbRename($owner, $db, $new_name); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbRename: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **new_name** | **string**| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbRestore()` - -```php -dbRestore($owner, $db) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | user name -$db = 'db_example'; // string | db name - -try { - $apiInstance->dbRestore($owner, $db); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbRestore: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| user name | | -| **db** | **string**| db name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbUserAdd()` - -```php -dbUserAdd($owner, $db, $username, $db_role) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$username = 'username_example'; // string | user name -$db_role = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbUserRole(); // \Agnesoft\AgdbApi\Model\DbUserRole - -try { - $apiInstance->dbUserAdd($owner, $db, $username, $db_role); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbUserAdd: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **username** | **string**| user name | | -| **db_role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](../Model/.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbUserList()` - -```php -dbUserList($owner, $db): \Agnesoft\AgdbApi\Model\DbUser[] -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name - -try { - $result = $apiInstance->dbUserList($owner, $db); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbUserList: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | - -### Return type - -[**\Agnesoft\AgdbApi\Model\DbUser[]**](../Model/DbUser.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `dbUserRemove()` - -```php -dbUserRemove($owner, $db, $username) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$owner = 'owner_example'; // string | db owner user name -$db = 'db_example'; // string | db name -$username = 'username_example'; // string | user name - -try { - $apiInstance->dbUserRemove($owner, $db, $username); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->dbUserRemove: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **owner** | **string**| db owner user name | | -| **db** | **string**| db name | | -| **username** | **string**| user name | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `status()` - -```php -status() -``` - - - -### Example - -```php -status(); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->status: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `userChangePassword()` - -```php -userChangePassword($change_password) -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); -$change_password = new \Agnesoft\AgdbApi\Model\ChangePassword(); // \Agnesoft\AgdbApi\Model\ChangePassword - -try { - $apiInstance->userChangePassword($change_password); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->userChangePassword: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **change_password** | [**\Agnesoft\AgdbApi\Model\ChangePassword**](../Model/ChangePassword.md)| | | - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `userLogin()` - -```php -userLogin($user_login): string -``` - - - -### Example - -```php -userLogin($user_login); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->userLogin: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -| Name | Type | Description | Notes | -| ------------- | ------------- | ------------- | ------------- | -| **user_login** | [**\Agnesoft\AgdbApi\Model\UserLogin**](../Model/UserLogin.md)| | | - -### Return type - -**string** - -### Authorization - -No authorization required - -### HTTP request headers - -- **Content-Type**: `application/json` -- **Accept**: `text/plain` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `userLogout()` - -```php -userLogout() -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $apiInstance->userLogout(); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->userLogout: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -void (empty response body) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: Not defined - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) - -## `userStatus()` - -```php -userStatus(): \Agnesoft\AgdbApi\Model\UserStatus -``` - - - -### Example - -```php -setAccessToken('YOUR_ACCESS_TOKEN'); - - -$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( - // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. - // This is optional, `GuzzleHttp\Client` will be used as default. - new GuzzleHttp\Client(), - $config -); - -try { - $result = $apiInstance->userStatus(); - print_r($result); -} catch (Exception $e) { - echo 'Exception when calling AgdbApi->userStatus: ', $e->getMessage(), PHP_EOL; -} -``` - -### Parameters - -This endpoint does not need any parameter. - -### Return type - -[**\Agnesoft\AgdbApi\Model\UserStatus**](../Model/UserStatus.md) - -### Authorization - -[Token](../../README.md#Token) - -### HTTP request headers - -- **Content-Type**: Not defined -- **Accept**: `application/json` - -[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) -[[Back to Model list]](../../README.md#models) -[[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/AdminStatus.md b/agdb_api/php/docs/Model/AdminStatus.md deleted file mode 100644 index 8064c920..00000000 --- a/agdb_api/php/docs/Model/AdminStatus.md +++ /dev/null @@ -1,13 +0,0 @@ -# # AdminStatus - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**dbs** | **int** | | -**logged_in_users** | **int** | | -**size** | **int** | | -**uptime** | **int** | | -**users** | **int** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ChangePassword.md b/agdb_api/php/docs/Model/ChangePassword.md deleted file mode 100644 index 303d974b..00000000 --- a/agdb_api/php/docs/Model/ChangePassword.md +++ /dev/null @@ -1,10 +0,0 @@ -# # ChangePassword - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**new_password** | **string** | | -**password** | **string** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ClusterStatus.md b/agdb_api/php/docs/Model/ClusterStatus.md deleted file mode 100644 index 3e81a143..00000000 --- a/agdb_api/php/docs/Model/ClusterStatus.md +++ /dev/null @@ -1,13 +0,0 @@ -# # ClusterStatus - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**address** | **string** | | -**commit** | **int** | | -**leader** | **bool** | | -**status** | **bool** | | -**term** | **int** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/Comparison.md b/agdb_api/php/docs/Model/Comparison.md deleted file mode 100644 index efad71d5..00000000 --- a/agdb_api/php/docs/Model/Comparison.md +++ /dev/null @@ -1,15 +0,0 @@ -# # Comparison - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**greater_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**greater_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**less_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**less_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**not_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**contains** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf.md b/agdb_api/php/docs/Model/ComparisonOneOf.md deleted file mode 100644 index aa25edb3..00000000 --- a/agdb_api/php/docs/Model/ComparisonOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ComparisonOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf1.md b/agdb_api/php/docs/Model/ComparisonOneOf1.md deleted file mode 100644 index 47e5990d..00000000 --- a/agdb_api/php/docs/Model/ComparisonOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ComparisonOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**greater_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf2.md b/agdb_api/php/docs/Model/ComparisonOneOf2.md deleted file mode 100644 index ea12a9ec..00000000 --- a/agdb_api/php/docs/Model/ComparisonOneOf2.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ComparisonOneOf2 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**greater_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf3.md b/agdb_api/php/docs/Model/ComparisonOneOf3.md deleted file mode 100644 index e749ef0e..00000000 --- a/agdb_api/php/docs/Model/ComparisonOneOf3.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ComparisonOneOf3 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**less_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf4.md b/agdb_api/php/docs/Model/ComparisonOneOf4.md deleted file mode 100644 index 485bdb38..00000000 --- a/agdb_api/php/docs/Model/ComparisonOneOf4.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ComparisonOneOf4 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**less_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf5.md b/agdb_api/php/docs/Model/ComparisonOneOf5.md deleted file mode 100644 index 61089d1e..00000000 --- a/agdb_api/php/docs/Model/ComparisonOneOf5.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ComparisonOneOf5 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**not_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf6.md b/agdb_api/php/docs/Model/ComparisonOneOf6.md deleted file mode 100644 index dbfab86d..00000000 --- a/agdb_api/php/docs/Model/ComparisonOneOf6.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ComparisonOneOf6 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**contains** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparison.md b/agdb_api/php/docs/Model/CountComparison.md deleted file mode 100644 index 3d764d53..00000000 --- a/agdb_api/php/docs/Model/CountComparison.md +++ /dev/null @@ -1,14 +0,0 @@ -# # CountComparison - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**equal** | **int** | property == this | -**greater_than** | **int** | property > this | -**greater_than_or_equal** | **int** | property >= this | -**less_than** | **int** | property < this | -**less_than_or_equal** | **int** | property <= this | -**not_equal** | **int** | property != this | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf.md b/agdb_api/php/docs/Model/CountComparisonOneOf.md deleted file mode 100644 index 1c54e5b7..00000000 --- a/agdb_api/php/docs/Model/CountComparisonOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # CountComparisonOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**equal** | **int** | property == this | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf1.md b/agdb_api/php/docs/Model/CountComparisonOneOf1.md deleted file mode 100644 index f3a5dcb8..00000000 --- a/agdb_api/php/docs/Model/CountComparisonOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # CountComparisonOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**greater_than** | **int** | property > this | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf2.md b/agdb_api/php/docs/Model/CountComparisonOneOf2.md deleted file mode 100644 index f441cdae..00000000 --- a/agdb_api/php/docs/Model/CountComparisonOneOf2.md +++ /dev/null @@ -1,9 +0,0 @@ -# # CountComparisonOneOf2 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**greater_than_or_equal** | **int** | property >= this | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf3.md b/agdb_api/php/docs/Model/CountComparisonOneOf3.md deleted file mode 100644 index 27511458..00000000 --- a/agdb_api/php/docs/Model/CountComparisonOneOf3.md +++ /dev/null @@ -1,9 +0,0 @@ -# # CountComparisonOneOf3 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**less_than** | **int** | property < this | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf4.md b/agdb_api/php/docs/Model/CountComparisonOneOf4.md deleted file mode 100644 index fa872bcb..00000000 --- a/agdb_api/php/docs/Model/CountComparisonOneOf4.md +++ /dev/null @@ -1,9 +0,0 @@ -# # CountComparisonOneOf4 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**less_than_or_equal** | **int** | property <= this | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf5.md b/agdb_api/php/docs/Model/CountComparisonOneOf5.md deleted file mode 100644 index 5b6e9da6..00000000 --- a/agdb_api/php/docs/Model/CountComparisonOneOf5.md +++ /dev/null @@ -1,9 +0,0 @@ -# # CountComparisonOneOf5 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**not_equal** | **int** | property != this | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbElement.md b/agdb_api/php/docs/Model/DbElement.md deleted file mode 100644 index 048447e4..00000000 --- a/agdb_api/php/docs/Model/DbElement.md +++ /dev/null @@ -1,12 +0,0 @@ -# # DbElement - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**from** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | [optional] -**id** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | -**to** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | [optional] -**values** | [**\Agnesoft\AgdbApi\Model\DbKeyValue[]**](DbKeyValue.md) | List of key-value pairs associated with the element. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyOrder.md b/agdb_api/php/docs/Model/DbKeyOrder.md deleted file mode 100644 index af990bf0..00000000 --- a/agdb_api/php/docs/Model/DbKeyOrder.md +++ /dev/null @@ -1,10 +0,0 @@ -# # DbKeyOrder - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**asc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**desc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyOrderOneOf.md b/agdb_api/php/docs/Model/DbKeyOrderOneOf.md deleted file mode 100644 index 1de1bbaa..00000000 --- a/agdb_api/php/docs/Model/DbKeyOrderOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbKeyOrderOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**asc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyOrderOneOf1.md b/agdb_api/php/docs/Model/DbKeyOrderOneOf1.md deleted file mode 100644 index 10d87bb9..00000000 --- a/agdb_api/php/docs/Model/DbKeyOrderOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbKeyOrderOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**desc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyValue.md b/agdb_api/php/docs/Model/DbKeyValue.md deleted file mode 100644 index 663bb375..00000000 --- a/agdb_api/php/docs/Model/DbKeyValue.md +++ /dev/null @@ -1,10 +0,0 @@ -# # DbKeyValue - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**key** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**value** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbResource.md b/agdb_api/php/docs/Model/DbResource.md deleted file mode 100644 index f069b646..00000000 --- a/agdb_api/php/docs/Model/DbResource.md +++ /dev/null @@ -1,8 +0,0 @@ -# # DbResource - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbType.md b/agdb_api/php/docs/Model/DbType.md deleted file mode 100644 index 3105f244..00000000 --- a/agdb_api/php/docs/Model/DbType.md +++ /dev/null @@ -1,8 +0,0 @@ -# # DbType - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbTypeParam.md b/agdb_api/php/docs/Model/DbTypeParam.md deleted file mode 100644 index 190155fa..00000000 --- a/agdb_api/php/docs/Model/DbTypeParam.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbTypeParam - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](DbType.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbUser.md b/agdb_api/php/docs/Model/DbUser.md deleted file mode 100644 index 210d6fde..00000000 --- a/agdb_api/php/docs/Model/DbUser.md +++ /dev/null @@ -1,10 +0,0 @@ -# # DbUser - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](DbUserRole.md) | | -**user** | **string** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbUserRole.md b/agdb_api/php/docs/Model/DbUserRole.md deleted file mode 100644 index 6a77a73a..00000000 --- a/agdb_api/php/docs/Model/DbUserRole.md +++ /dev/null @@ -1,8 +0,0 @@ -# # DbUserRole - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbUserRoleParam.md b/agdb_api/php/docs/Model/DbUserRoleParam.md deleted file mode 100644 index 315704aa..00000000 --- a/agdb_api/php/docs/Model/DbUserRoleParam.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbUserRoleParam - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**db_role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](DbUserRole.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValue.md b/agdb_api/php/docs/Model/DbValue.md deleted file mode 100644 index 10cf9313..00000000 --- a/agdb_api/php/docs/Model/DbValue.md +++ /dev/null @@ -1,17 +0,0 @@ -# # DbValue - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bytes** | **\SplFileObject** | Byte array, sometimes referred to as blob | -**i64** | **int** | 64-bit wide signed integer | -**u64** | **int** | 64-bit wide unsigned integer | -**f64** | **float** | Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. | -**string** | **string** | UTF-8 string | -**vec_i64** | **int[]** | List of 64-bit wide signed integers | -**vec_u64** | **int[]** | List of 64-bit wide unsigned integers | -**vec_f64** | **float[]** | List of 64-bit floating point numbers | -**vec_string** | **string[]** | List of UTF-8 strings | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf.md b/agdb_api/php/docs/Model/DbValueOneOf.md deleted file mode 100644 index 9790862b..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**bytes** | **\SplFileObject** | Byte array, sometimes referred to as blob | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf1.md b/agdb_api/php/docs/Model/DbValueOneOf1.md deleted file mode 100644 index 3041c3d4..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**i64** | **int** | 64-bit wide signed integer | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf2.md b/agdb_api/php/docs/Model/DbValueOneOf2.md deleted file mode 100644 index 7015fa78..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf2.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf2 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**u64** | **int** | 64-bit wide unsigned integer | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf3.md b/agdb_api/php/docs/Model/DbValueOneOf3.md deleted file mode 100644 index bc77db84..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf3.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf3 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**f64** | **float** | Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf4.md b/agdb_api/php/docs/Model/DbValueOneOf4.md deleted file mode 100644 index 9bcb40bd..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf4.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf4 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**string** | **string** | UTF-8 string | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf5.md b/agdb_api/php/docs/Model/DbValueOneOf5.md deleted file mode 100644 index c54a4509..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf5.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf5 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**vec_i64** | **int[]** | List of 64-bit wide signed integers | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf6.md b/agdb_api/php/docs/Model/DbValueOneOf6.md deleted file mode 100644 index 04c8c49d..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf6.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf6 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**vec_u64** | **int[]** | List of 64-bit wide unsigned integers | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf7.md b/agdb_api/php/docs/Model/DbValueOneOf7.md deleted file mode 100644 index 02a41a37..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf7.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf7 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**vec_f64** | **float[]** | List of 64-bit floating point numbers | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf8.md b/agdb_api/php/docs/Model/DbValueOneOf8.md deleted file mode 100644 index 6d3cfe0f..00000000 --- a/agdb_api/php/docs/Model/DbValueOneOf8.md +++ /dev/null @@ -1,9 +0,0 @@ -# # DbValueOneOf8 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**vec_string** | **string[]** | List of UTF-8 strings | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertAliasesQuery.md b/agdb_api/php/docs/Model/InsertAliasesQuery.md deleted file mode 100644 index ff7d8c4d..00000000 --- a/agdb_api/php/docs/Model/InsertAliasesQuery.md +++ /dev/null @@ -1,10 +0,0 @@ -# # InsertAliasesQuery - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**aliases** | **string[]** | Aliases to be inserted | -**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertEdgesQuery.md b/agdb_api/php/docs/Model/InsertEdgesQuery.md deleted file mode 100644 index 0f5841e4..00000000 --- a/agdb_api/php/docs/Model/InsertEdgesQuery.md +++ /dev/null @@ -1,13 +0,0 @@ -# # InsertEdgesQuery - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**each** | **bool** | If `true` create an edge between each origin and destination. | -**from** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**to** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**values** | [**\Agnesoft\AgdbApi\Model\QueryValues**](QueryValues.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertNodesQuery.md b/agdb_api/php/docs/Model/InsertNodesQuery.md deleted file mode 100644 index 6cc75b54..00000000 --- a/agdb_api/php/docs/Model/InsertNodesQuery.md +++ /dev/null @@ -1,12 +0,0 @@ -# # InsertNodesQuery - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**aliases** | **string[]** | Aliases of the new nodes. | -**count** | **int** | Number of nodes to be inserted. | -**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**values** | [**\Agnesoft\AgdbApi\Model\QueryValues**](QueryValues.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertValuesQuery.md b/agdb_api/php/docs/Model/InsertValuesQuery.md deleted file mode 100644 index 383a2a02..00000000 --- a/agdb_api/php/docs/Model/InsertValuesQuery.md +++ /dev/null @@ -1,10 +0,0 @@ -# # InsertValuesQuery - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**values** | [**\Agnesoft\AgdbApi\Model\QueryValues**](QueryValues.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryAudit.md b/agdb_api/php/docs/Model/QueryAudit.md deleted file mode 100644 index d9f2c0d8..00000000 --- a/agdb_api/php/docs/Model/QueryAudit.md +++ /dev/null @@ -1,11 +0,0 @@ -# # QueryAudit - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**query** | [**\Agnesoft\AgdbApi\Model\QueryType**](QueryType.md) | | -**timestamp** | **int** | | -**user** | **string** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryCondition.md b/agdb_api/php/docs/Model/QueryCondition.md deleted file mode 100644 index df8693b9..00000000 --- a/agdb_api/php/docs/Model/QueryCondition.md +++ /dev/null @@ -1,11 +0,0 @@ -# # QueryCondition - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**data** | [**\Agnesoft\AgdbApi\Model\QueryConditionData**](QueryConditionData.md) | | -**logic** | [**\Agnesoft\AgdbApi\Model\QueryConditionLogic**](QueryConditionLogic.md) | | -**modifier** | [**\Agnesoft\AgdbApi\Model\QueryConditionModifier**](QueryConditionModifier.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionData.md b/agdb_api/php/docs/Model/QueryConditionData.md deleted file mode 100644 index 503a092c..00000000 --- a/agdb_api/php/docs/Model/QueryConditionData.md +++ /dev/null @@ -1,16 +0,0 @@ -# # QueryConditionData - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**distance** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | -**edge_count** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | -**edge_count_from** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | -**edge_count_to** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | -**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | Tests if the current id is in the list of ids. | -**key_value** | [**\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue**](QueryConditionDataOneOf5KeyValue.md) | | -**keys** | [**\Agnesoft\AgdbApi\Model\DbValue[]**](DbValue.md) | Test if the current element has **all** of the keys listed. | -**where** | [**\Agnesoft\AgdbApi\Model\QueryCondition[]**](QueryCondition.md) | Nested list of conditions (equivalent to brackets). | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf.md deleted file mode 100644 index b4f24a82..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**distance** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf1.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf1.md deleted file mode 100644 index b5af9f92..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**edge_count** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf2.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf2.md deleted file mode 100644 index 94632b44..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf2.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf2 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**edge_count_from** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf3.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf3.md deleted file mode 100644 index 647e90d2..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf3.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf3 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**edge_count_to** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf4.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf4.md deleted file mode 100644 index 899dd7ea..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf4.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf4 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | Tests if the current id is in the list of ids. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf5.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf5.md deleted file mode 100644 index 3815cb25..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf5.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf5 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**key_value** | [**\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue**](QueryConditionDataOneOf5KeyValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md deleted file mode 100644 index 978dcac6..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md +++ /dev/null @@ -1,10 +0,0 @@ -# # QueryConditionDataOneOf5KeyValue - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**key** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**value** | [**\Agnesoft\AgdbApi\Model\Comparison**](Comparison.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf6.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf6.md deleted file mode 100644 index ad7ba7bb..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf6.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf6 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**keys** | [**\Agnesoft\AgdbApi\Model\DbValue[]**](DbValue.md) | Test if the current element has **all** of the keys listed. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf7.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf7.md deleted file mode 100644 index 702fff07..00000000 --- a/agdb_api/php/docs/Model/QueryConditionDataOneOf7.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryConditionDataOneOf7 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**where** | [**\Agnesoft\AgdbApi\Model\QueryCondition[]**](QueryCondition.md) | Nested list of conditions (equivalent to brackets). | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionLogic.md b/agdb_api/php/docs/Model/QueryConditionLogic.md deleted file mode 100644 index 09262f08..00000000 --- a/agdb_api/php/docs/Model/QueryConditionLogic.md +++ /dev/null @@ -1,8 +0,0 @@ -# # QueryConditionLogic - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionModifier.md b/agdb_api/php/docs/Model/QueryConditionModifier.md deleted file mode 100644 index 89857ecf..00000000 --- a/agdb_api/php/docs/Model/QueryConditionModifier.md +++ /dev/null @@ -1,8 +0,0 @@ -# # QueryConditionModifier - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryId.md b/agdb_api/php/docs/Model/QueryId.md deleted file mode 100644 index eb0bb2f5..00000000 --- a/agdb_api/php/docs/Model/QueryId.md +++ /dev/null @@ -1,10 +0,0 @@ -# # QueryId - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | -**alias** | **string** | String alias | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdOneOf.md b/agdb_api/php/docs/Model/QueryIdOneOf.md deleted file mode 100644 index 3d33d36d..00000000 --- a/agdb_api/php/docs/Model/QueryIdOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryIdOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**id** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdOneOf1.md b/agdb_api/php/docs/Model/QueryIdOneOf1.md deleted file mode 100644 index 23b97a7b..00000000 --- a/agdb_api/php/docs/Model/QueryIdOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryIdOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**alias** | **string** | String alias | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIds.md b/agdb_api/php/docs/Model/QueryIds.md deleted file mode 100644 index 35328ff8..00000000 --- a/agdb_api/php/docs/Model/QueryIds.md +++ /dev/null @@ -1,10 +0,0 @@ -# # QueryIds - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | List of [`QueryId`]s | -**search** | [**\Agnesoft\AgdbApi\Model\SearchQuery**](SearchQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdsOneOf.md b/agdb_api/php/docs/Model/QueryIdsOneOf.md deleted file mode 100644 index a882f791..00000000 --- a/agdb_api/php/docs/Model/QueryIdsOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryIdsOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | List of [`QueryId`]s | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdsOneOf1.md b/agdb_api/php/docs/Model/QueryIdsOneOf1.md deleted file mode 100644 index 8f81a659..00000000 --- a/agdb_api/php/docs/Model/QueryIdsOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryIdsOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**search** | [**\Agnesoft\AgdbApi\Model\SearchQuery**](SearchQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryResult.md b/agdb_api/php/docs/Model/QueryResult.md deleted file mode 100644 index 3ff74508..00000000 --- a/agdb_api/php/docs/Model/QueryResult.md +++ /dev/null @@ -1,10 +0,0 @@ -# # QueryResult - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**elements** | [**\Agnesoft\AgdbApi\Model\DbElement[]**](DbElement.md) | List of elements yielded by the query possibly with a list of properties. | -**result** | **int** | Query result | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryType.md b/agdb_api/php/docs/Model/QueryType.md deleted file mode 100644 index 07ea0951..00000000 --- a/agdb_api/php/docs/Model/QueryType.md +++ /dev/null @@ -1,26 +0,0 @@ -# # QueryType - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**insert_alias** | [**\Agnesoft\AgdbApi\Model\InsertAliasesQuery**](InsertAliasesQuery.md) | | -**insert_edges** | [**\Agnesoft\AgdbApi\Model\InsertEdgesQuery**](InsertEdgesQuery.md) | | -**insert_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**insert_nodes** | [**\Agnesoft\AgdbApi\Model\InsertNodesQuery**](InsertNodesQuery.md) | | -**insert_values** | [**\Agnesoft\AgdbApi\Model\InsertValuesQuery**](InsertValuesQuery.md) | | -**remove** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**remove_aliases** | **string[]** | Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. | -**remove_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | -**remove_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | -**search** | [**\Agnesoft\AgdbApi\Model\SearchQuery**](SearchQuery.md) | | -**select_aliases** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**select_all_aliases** | **object** | Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. | -**select_edge_count** | [**\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery**](SelectEdgeCountQuery.md) | | -**select_indexes** | **object** | Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. | -**select_keys** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**select_key_count** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**select_node_count** | **object** | Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. | -**select_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf.md b/agdb_api/php/docs/Model/QueryTypeOneOf.md deleted file mode 100644 index 43fea3b2..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**insert_alias** | [**\Agnesoft\AgdbApi\Model\InsertAliasesQuery**](InsertAliasesQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf1.md b/agdb_api/php/docs/Model/QueryTypeOneOf1.md deleted file mode 100644 index dd2ac404..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**insert_edges** | [**\Agnesoft\AgdbApi\Model\InsertEdgesQuery**](InsertEdgesQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf10.md b/agdb_api/php/docs/Model/QueryTypeOneOf10.md deleted file mode 100644 index b5331877..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf10.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf10 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_all_aliases** | **object** | Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf11.md b/agdb_api/php/docs/Model/QueryTypeOneOf11.md deleted file mode 100644 index 8d7c9bb7..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf11.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf11 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_edge_count** | [**\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery**](SelectEdgeCountQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf12.md b/agdb_api/php/docs/Model/QueryTypeOneOf12.md deleted file mode 100644 index c0c9803b..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf12.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf12 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_indexes** | **object** | Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf13.md b/agdb_api/php/docs/Model/QueryTypeOneOf13.md deleted file mode 100644 index ce49cdf3..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf13.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf13 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_keys** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf14.md b/agdb_api/php/docs/Model/QueryTypeOneOf14.md deleted file mode 100644 index 31fe5c86..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf14.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf14 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_key_count** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf15.md b/agdb_api/php/docs/Model/QueryTypeOneOf15.md deleted file mode 100644 index e5eee1ed..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf15.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf15 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_node_count** | **object** | Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf16.md b/agdb_api/php/docs/Model/QueryTypeOneOf16.md deleted file mode 100644 index c7338d5c..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf16.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf16 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf2.md b/agdb_api/php/docs/Model/QueryTypeOneOf2.md deleted file mode 100644 index 243dac8d..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf2.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf2 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**insert_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf3.md b/agdb_api/php/docs/Model/QueryTypeOneOf3.md deleted file mode 100644 index 0c68f574..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf3.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf3 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**insert_nodes** | [**\Agnesoft\AgdbApi\Model\InsertNodesQuery**](InsertNodesQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf4.md b/agdb_api/php/docs/Model/QueryTypeOneOf4.md deleted file mode 100644 index 3645a038..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf4.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf4 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**insert_values** | [**\Agnesoft\AgdbApi\Model\InsertValuesQuery**](InsertValuesQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf5.md b/agdb_api/php/docs/Model/QueryTypeOneOf5.md deleted file mode 100644 index 31293bc1..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf5.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf5 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**remove** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf6.md b/agdb_api/php/docs/Model/QueryTypeOneOf6.md deleted file mode 100644 index 93fa6ef7..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf6.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf6 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**remove_aliases** | **string[]** | Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf7.md b/agdb_api/php/docs/Model/QueryTypeOneOf7.md deleted file mode 100644 index 37fcdb20..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf7.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf7 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**remove_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf8.md b/agdb_api/php/docs/Model/QueryTypeOneOf8.md deleted file mode 100644 index ef4f97f3..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf8.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf8 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**remove_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf9.md b/agdb_api/php/docs/Model/QueryTypeOneOf9.md deleted file mode 100644 index fee634c6..00000000 --- a/agdb_api/php/docs/Model/QueryTypeOneOf9.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryTypeOneOf9 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**select_aliases** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryValues.md b/agdb_api/php/docs/Model/QueryValues.md deleted file mode 100644 index 5d54850f..00000000 --- a/agdb_api/php/docs/Model/QueryValues.md +++ /dev/null @@ -1,10 +0,0 @@ -# # QueryValues - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**single** | [**\Agnesoft\AgdbApi\Model\DbKeyValue[]**](DbKeyValue.md) | Single list of properties (key-value pairs) to be applied to all elements in a query. | -**multi** | **\Agnesoft\AgdbApi\Model\DbKeyValue[][]** | List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryValuesOneOf.md b/agdb_api/php/docs/Model/QueryValuesOneOf.md deleted file mode 100644 index 3b703a4c..00000000 --- a/agdb_api/php/docs/Model/QueryValuesOneOf.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryValuesOneOf - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**single** | [**\Agnesoft\AgdbApi\Model\DbKeyValue[]**](DbKeyValue.md) | Single list of properties (key-value pairs) to be applied to all elements in a query. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryValuesOneOf1.md b/agdb_api/php/docs/Model/QueryValuesOneOf1.md deleted file mode 100644 index 996395d6..00000000 --- a/agdb_api/php/docs/Model/QueryValuesOneOf1.md +++ /dev/null @@ -1,9 +0,0 @@ -# # QueryValuesOneOf1 - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**multi** | **\Agnesoft\AgdbApi\Model\DbKeyValue[][]** | List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SearchQuery.md b/agdb_api/php/docs/Model/SearchQuery.md deleted file mode 100644 index 6f7c7d46..00000000 --- a/agdb_api/php/docs/Model/SearchQuery.md +++ /dev/null @@ -1,15 +0,0 @@ -# # SearchQuery - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**algorithm** | [**\Agnesoft\AgdbApi\Model\SearchQueryAlgorithm**](SearchQueryAlgorithm.md) | | -**conditions** | [**\Agnesoft\AgdbApi\Model\QueryCondition[]**](QueryCondition.md) | Set of conditions every element must satisfy to be included in the result. Some conditions also influence the search path as well. | -**destination** | [**\Agnesoft\AgdbApi\Model\QueryId**](QueryId.md) | | -**limit** | **int** | How many elements maximum to return. | -**offset** | **int** | How many elements that would be returned should be skipped in the result. | -**order_by** | [**\Agnesoft\AgdbApi\Model\DbKeyOrder[]**](DbKeyOrder.md) | Order of the elements in the result. The sorting happens before `offset` and `limit` are applied. | -**origin** | [**\Agnesoft\AgdbApi\Model\QueryId**](QueryId.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SearchQueryAlgorithm.md b/agdb_api/php/docs/Model/SearchQueryAlgorithm.md deleted file mode 100644 index 1c35f207..00000000 --- a/agdb_api/php/docs/Model/SearchQueryAlgorithm.md +++ /dev/null @@ -1,8 +0,0 @@ -# # SearchQueryAlgorithm - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SelectEdgeCountQuery.md b/agdb_api/php/docs/Model/SelectEdgeCountQuery.md deleted file mode 100644 index 692d37ec..00000000 --- a/agdb_api/php/docs/Model/SelectEdgeCountQuery.md +++ /dev/null @@ -1,11 +0,0 @@ -# # SelectEdgeCountQuery - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**from** | **bool** | If set to `true` the query will count outgoing edges from the nodes. | -**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**to** | **bool** | If set to `true` the query will count incoming edges to the nodes. | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SelectValuesQuery.md b/agdb_api/php/docs/Model/SelectValuesQuery.md deleted file mode 100644 index d9fac118..00000000 --- a/agdb_api/php/docs/Model/SelectValuesQuery.md +++ /dev/null @@ -1,10 +0,0 @@ -# # SelectValuesQuery - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | -**keys** | [**\Agnesoft\AgdbApi\Model\DbValue[]**](DbValue.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ServerDatabase.md b/agdb_api/php/docs/Model/ServerDatabase.md deleted file mode 100644 index 7aba497c..00000000 --- a/agdb_api/php/docs/Model/ServerDatabase.md +++ /dev/null @@ -1,13 +0,0 @@ -# # ServerDatabase - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**backup** | **int** | | -**db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](DbType.md) | | -**name** | **string** | | -**role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](DbUserRole.md) | | -**size** | **int** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ServerDatabaseRename.md b/agdb_api/php/docs/Model/ServerDatabaseRename.md deleted file mode 100644 index fd9ce4e6..00000000 --- a/agdb_api/php/docs/Model/ServerDatabaseRename.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ServerDatabaseRename - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**new_name** | **string** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ServerDatabaseResource.md b/agdb_api/php/docs/Model/ServerDatabaseResource.md deleted file mode 100644 index 9f3d241f..00000000 --- a/agdb_api/php/docs/Model/ServerDatabaseResource.md +++ /dev/null @@ -1,9 +0,0 @@ -# # ServerDatabaseResource - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**resource** | [**\Agnesoft\AgdbApi\Model\DbResource**](DbResource.md) | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/UserCredentials.md b/agdb_api/php/docs/Model/UserCredentials.md deleted file mode 100644 index 97407933..00000000 --- a/agdb_api/php/docs/Model/UserCredentials.md +++ /dev/null @@ -1,9 +0,0 @@ -# # UserCredentials - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**password** | **string** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/UserLogin.md b/agdb_api/php/docs/Model/UserLogin.md deleted file mode 100644 index 5629c753..00000000 --- a/agdb_api/php/docs/Model/UserLogin.md +++ /dev/null @@ -1,10 +0,0 @@ -# # UserLogin - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**password** | **string** | | -**username** | **string** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/UserStatus.md b/agdb_api/php/docs/Model/UserStatus.md deleted file mode 100644 index 6da5bce1..00000000 --- a/agdb_api/php/docs/Model/UserStatus.md +++ /dev/null @@ -1,11 +0,0 @@ -# # UserStatus - -## Properties - -Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- -**admin** | **bool** | | -**login** | **bool** | | -**name** | **string** | | - -[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/lib/Api/AgdbApi.php b/agdb_api/php/lib/Api/AgdbApi.php deleted file mode 100644 index c35bfb58..00000000 --- a/agdb_api/php/lib/Api/AgdbApi.php +++ /dev/null @@ -1,11964 +0,0 @@ - [ - 'application/json', - ], - 'adminDbAudit' => [ - 'application/json', - ], - 'adminDbBackup' => [ - 'application/json', - ], - 'adminDbConvert' => [ - 'application/json', - ], - 'adminDbCopy' => [ - 'application/json', - ], - 'adminDbDelete' => [ - 'application/json', - ], - 'adminDbExec' => [ - 'application/json', - ], - 'adminDbList' => [ - 'application/json', - ], - 'adminDbOptimize' => [ - 'application/json', - ], - 'adminDbRemove' => [ - 'application/json', - ], - 'adminDbRename' => [ - 'application/json', - ], - 'adminDbRestore' => [ - 'application/json', - ], - 'adminDbUserAdd' => [ - 'application/json', - ], - 'adminDbUserList' => [ - 'application/json', - ], - 'adminDbUserRemove' => [ - 'application/json', - ], - 'adminShutdown' => [ - 'application/json', - ], - 'adminStatus' => [ - 'application/json', - ], - 'adminUserAdd' => [ - 'application/json', - ], - 'adminUserChangePassword' => [ - 'application/json', - ], - 'adminUserList' => [ - 'application/json', - ], - 'adminUserLogout' => [ - 'application/json', - ], - 'adminUserRemove' => [ - 'application/json', - ], - 'clusterStatus' => [ - 'application/json', - ], - 'dbAdd' => [ - 'application/json', - ], - 'dbAudit' => [ - 'application/json', - ], - 'dbBackup' => [ - 'application/json', - ], - 'dbClear' => [ - 'application/json', - ], - 'dbConvert' => [ - 'application/json', - ], - 'dbCopy' => [ - 'application/json', - ], - 'dbDelete' => [ - 'application/json', - ], - 'dbExec' => [ - 'application/json', - ], - 'dbList' => [ - 'application/json', - ], - 'dbOptimize' => [ - 'application/json', - ], - 'dbRemove' => [ - 'application/json', - ], - 'dbRename' => [ - 'application/json', - ], - 'dbRestore' => [ - 'application/json', - ], - 'dbUserAdd' => [ - 'application/json', - ], - 'dbUserList' => [ - 'application/json', - ], - 'dbUserRemove' => [ - 'application/json', - ], - 'status' => [ - 'application/json', - ], - 'userChangePassword' => [ - 'application/json', - ], - 'userLogin' => [ - 'application/json', - ], - 'userLogout' => [ - 'application/json', - ], - 'userStatus' => [ - 'application/json', - ], - ]; - - /** - * @param ClientInterface $client - * @param Configuration $config - * @param HeaderSelector $selector - * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec - */ - public function __construct( - ClientInterface $client = null, - Configuration $config = null, - HeaderSelector $selector = null, - $hostIndex = 0 - ) { - $this->client = $client ?: new Client(); - $this->config = $config ?: Configuration::getDefaultConfiguration(); - $this->headerSelector = $selector ?: new HeaderSelector(); - $this->hostIndex = $hostIndex; - } - - /** - * Set the host index - * - * @param int $hostIndex Host index (required) - */ - public function setHostIndex($hostIndex): void - { - $this->hostIndex = $hostIndex; - } - - /** - * Get the host index - * - * @return int Host index - */ - public function getHostIndex() - { - return $this->hostIndex; - } - - /** - * @return Configuration - */ - public function getConfig() - { - return $this->config; - } - - /** - * Operation adminDbAdd - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbAdd($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) - { - $this->adminDbAddWithHttpInfo($owner, $db, $db_type, $contentType); - } - - /** - * Operation adminDbAddWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbAddWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) - { - $request = $this->adminDbAddRequest($owner, $db, $db_type, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbAddAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbAddAsync($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) - { - return $this->adminDbAddAsyncWithHttpInfo($owner, $db, $db_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbAddAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbAddAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) - { - $returnType = ''; - $request = $this->adminDbAddRequest($owner, $db, $db_type, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbAdd' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbAddRequest($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbAdd' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbAdd' - ); - } - - // verify the required parameter 'db_type' is set - if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db_type when calling adminDbAdd' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $db_type, - 'db_type', // param base name - 'DbType', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbAudit - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\QueryAudit[] - */ - public function adminDbAudit($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) - { - list($response) = $this->adminDbAuditWithHttpInfo($owner, $db, $contentType); - return $response; - } - - /** - * Operation adminDbAuditWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\QueryAudit[], HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbAuditWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) - { - $request = $this->adminDbAuditRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryAudit[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\QueryAudit[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminDbAuditAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbAuditAsync($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) - { - return $this->adminDbAuditAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbAuditAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbAuditAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; - $request = $this->adminDbAuditRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbAudit' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbAuditRequest($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbAudit' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbAudit' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/audit'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbBackup - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbBackup($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) - { - $this->adminDbBackupWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation adminDbBackupWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbBackupWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) - { - $request = $this->adminDbBackupRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbBackupAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbBackupAsync($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) - { - return $this->adminDbBackupAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbBackupAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbBackupAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) - { - $returnType = ''; - $request = $this->adminDbBackupRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbBackup' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbBackupRequest($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbBackup' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbBackup' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/backup'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbConvert - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbConvert($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) - { - $this->adminDbConvertWithHttpInfo($owner, $db, $db_type, $contentType); - } - - /** - * Operation adminDbConvertWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbConvertWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) - { - $request = $this->adminDbConvertRequest($owner, $db, $db_type, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbConvertAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbConvertAsync($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) - { - return $this->adminDbConvertAsyncWithHttpInfo($owner, $db, $db_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbConvertAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbConvertAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) - { - $returnType = ''; - $request = $this->adminDbConvertRequest($owner, $db, $db_type, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbConvert' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbConvertRequest($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbConvert' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbConvert' - ); - } - - // verify the required parameter 'db_type' is set - if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db_type when calling adminDbConvert' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/convert'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $db_type, - 'db_type', // param base name - 'DbType', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbCopy - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbCopy($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) - { - $this->adminDbCopyWithHttpInfo($owner, $db, $new_name, $contentType); - } - - /** - * Operation adminDbCopyWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbCopyWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) - { - $request = $this->adminDbCopyRequest($owner, $db, $new_name, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbCopyAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbCopyAsync($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) - { - return $this->adminDbCopyAsyncWithHttpInfo($owner, $db, $new_name, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbCopyAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbCopyAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) - { - $returnType = ''; - $request = $this->adminDbCopyRequest($owner, $db, $new_name, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbCopy' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbCopyRequest($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbCopy' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbCopy' - ); - } - - // verify the required parameter 'new_name' is set - if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $new_name when calling adminDbCopy' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/copy'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $new_name, - 'new_name', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbDelete - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbDelete($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) - { - $this->adminDbDeleteWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation adminDbDeleteWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbDeleteWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) - { - $request = $this->adminDbDeleteRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbDeleteAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbDeleteAsync($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) - { - return $this->adminDbDeleteAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbDeleteAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbDeleteAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) - { - $returnType = ''; - $request = $this->adminDbDeleteRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbDelete' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbDeleteRequest($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbDelete' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbDelete' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/delete'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbExec - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\QueryResult[] - */ - public function adminDbExec($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) - { - list($response) = $this->adminDbExecWithHttpInfo($owner, $db, $query_type, $contentType); - return $response; - } - - /** - * Operation adminDbExecWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\QueryResult[], HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbExecWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) - { - $request = $this->adminDbExecRequest($owner, $db, $query_type, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\QueryResult[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\QueryResult[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryResult[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\QueryResult[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminDbExecAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbExecAsync($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) - { - return $this->adminDbExecAsyncWithHttpInfo($owner, $db, $query_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbExecAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbExecAsyncWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; - $request = $this->adminDbExecRequest($owner, $db, $query_type, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbExec' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbExecRequest($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbExec' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbExec' - ); - } - - // verify the required parameter 'query_type' is set - if ($query_type === null || (is_array($query_type) && count($query_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $query_type when calling adminDbExec' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/exec'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($query_type)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($query_type)); - } else { - $httpBody = $query_type; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbList - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\ServerDatabase[] - */ - public function adminDbList(string $contentType = self::contentTypes['adminDbList'][0]) - { - list($response) = $this->adminDbListWithHttpInfo($contentType); - return $response; - } - - /** - * Operation adminDbListWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase[], HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbListWithHttpInfo(string $contentType = self::contentTypes['adminDbList'][0]) - { - $request = $this->adminDbListRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\ServerDatabase[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminDbListAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbListAsync(string $contentType = self::contentTypes['adminDbList'][0]) - { - return $this->adminDbListAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbListAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbListAsyncWithHttpInfo(string $contentType = self::contentTypes['adminDbList'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; - $request = $this->adminDbListRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbList' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbListRequest(string $contentType = self::contentTypes['adminDbList'][0]) - { - - - $resourcePath = '/api/v1/admin/db/list'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbOptimize - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\ServerDatabase - */ - public function adminDbOptimize($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) - { - list($response) = $this->adminDbOptimizeWithHttpInfo($owner, $db, $contentType); - return $response; - } - - /** - * Operation adminDbOptimizeWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbOptimizeWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) - { - $request = $this->adminDbOptimizeRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\ServerDatabase' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\ServerDatabase' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\ServerDatabase', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminDbOptimizeAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbOptimizeAsync($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) - { - return $this->adminDbOptimizeAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbOptimizeAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbOptimizeAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; - $request = $this->adminDbOptimizeRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbOptimize' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbOptimizeRequest($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbOptimize' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbOptimize' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/optimize'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbRemove - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbRemove($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) - { - $this->adminDbRemoveWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation adminDbRemoveWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbRemoveWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) - { - $request = $this->adminDbRemoveRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbRemoveAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbRemoveAsync($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) - { - return $this->adminDbRemoveAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbRemoveAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbRemoveAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) - { - $returnType = ''; - $request = $this->adminDbRemoveRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbRemove' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbRemoveRequest($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbRemove' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbRemove' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbRename - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbRename($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) - { - $this->adminDbRenameWithHttpInfo($owner, $db, $new_name, $contentType); - } - - /** - * Operation adminDbRenameWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbRenameWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) - { - $request = $this->adminDbRenameRequest($owner, $db, $new_name, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbRenameAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbRenameAsync($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) - { - return $this->adminDbRenameAsyncWithHttpInfo($owner, $db, $new_name, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbRenameAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbRenameAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) - { - $returnType = ''; - $request = $this->adminDbRenameRequest($owner, $db, $new_name, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbRename' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbRenameRequest($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbRename' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbRename' - ); - } - - // verify the required parameter 'new_name' is set - if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $new_name when calling adminDbRename' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/rename'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $new_name, - 'new_name', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbRestore - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbRestore($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) - { - $this->adminDbRestoreWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation adminDbRestoreWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbRestoreWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) - { - $request = $this->adminDbRestoreRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbRestoreAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbRestoreAsync($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) - { - return $this->adminDbRestoreAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbRestoreAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbRestoreAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) - { - $returnType = ''; - $request = $this->adminDbRestoreRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbRestore' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbRestoreRequest($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbRestore' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbRestore' - ); - } - - - $resourcePath = '/api/v1/db/admin/{owner}/{db}/restore'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbUserAdd - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbUserAdd($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) - { - $this->adminDbUserAddWithHttpInfo($owner, $db, $username, $db_role, $contentType); - } - - /** - * Operation adminDbUserAddWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbUserAddWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) - { - $request = $this->adminDbUserAddRequest($owner, $db, $username, $db_role, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbUserAddAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbUserAddAsync($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) - { - return $this->adminDbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbUserAddAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) - { - $returnType = ''; - $request = $this->adminDbUserAddRequest($owner, $db, $username, $db_role, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbUserAdd' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbUserAddRequest($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbUserAdd' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbUserAdd' - ); - } - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling adminDbUserAdd' - ); - } - - // verify the required parameter 'db_role' is set - if ($db_role === null || (is_array($db_role) && count($db_role) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db_role when calling adminDbUserAdd' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/user/{username}/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $db_role, - 'db_role', // param base name - 'DbUserRole', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbUserList - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\DbUser[] - */ - public function adminDbUserList($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) - { - list($response) = $this->adminDbUserListWithHttpInfo($owner, $db, $contentType); - return $response; - } - - /** - * Operation adminDbUserListWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\DbUser[], HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbUserListWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) - { - $request = $this->adminDbUserListRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\DbUser[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\DbUser[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\DbUser[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\DbUser[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminDbUserListAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbUserListAsync($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) - { - return $this->adminDbUserListAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbUserListAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbUserListAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; - $request = $this->adminDbUserListRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbUserList' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbUserListRequest($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbUserList' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbUserList' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/user/list'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminDbUserRemove - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminDbUserRemove($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) - { - $this->adminDbUserRemoveWithHttpInfo($owner, $db, $username, $contentType); - } - - /** - * Operation adminDbUserRemoveWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminDbUserRemoveWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) - { - $request = $this->adminDbUserRemoveRequest($owner, $db, $username, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminDbUserRemoveAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbUserRemoveAsync($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) - { - return $this->adminDbUserRemoveAsyncWithHttpInfo($owner, $db, $username, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminDbUserRemoveAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminDbUserRemoveAsyncWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) - { - $returnType = ''; - $request = $this->adminDbUserRemoveRequest($owner, $db, $username, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminDbUserRemove' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminDbUserRemoveRequest($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling adminDbUserRemove' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling adminDbUserRemove' - ); - } - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling adminDbUserRemove' - ); - } - - - $resourcePath = '/api/v1/admin/db/{owner}/{db}/user/{username}/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminShutdown - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminShutdown(string $contentType = self::contentTypes['adminShutdown'][0]) - { - $this->adminShutdownWithHttpInfo($contentType); - } - - /** - * Operation adminShutdownWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminShutdownWithHttpInfo(string $contentType = self::contentTypes['adminShutdown'][0]) - { - $request = $this->adminShutdownRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminShutdownAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminShutdownAsync(string $contentType = self::contentTypes['adminShutdown'][0]) - { - return $this->adminShutdownAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminShutdownAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminShutdownAsyncWithHttpInfo(string $contentType = self::contentTypes['adminShutdown'][0]) - { - $returnType = ''; - $request = $this->adminShutdownRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminShutdown' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminShutdownRequest(string $contentType = self::contentTypes['adminShutdown'][0]) - { - - - $resourcePath = '/api/v1/admin/shutdown'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminStatus - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\AdminStatus - */ - public function adminStatus(string $contentType = self::contentTypes['adminStatus'][0]) - { - list($response) = $this->adminStatusWithHttpInfo($contentType); - return $response; - } - - /** - * Operation adminStatusWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\AdminStatus, HTTP status code, HTTP response headers (array of strings) - */ - public function adminStatusWithHttpInfo(string $contentType = self::contentTypes['adminStatus'][0]) - { - $request = $this->adminStatusRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\AdminStatus' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\AdminStatus' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\AdminStatus', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\AdminStatus'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\AdminStatus', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminStatusAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminStatusAsync(string $contentType = self::contentTypes['adminStatus'][0]) - { - return $this->adminStatusAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminStatusAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['adminStatus'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\AdminStatus'; - $request = $this->adminStatusRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminStatus' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminStatusRequest(string $contentType = self::contentTypes['adminStatus'][0]) - { - - - $resourcePath = '/api/v1/admin/status'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminUserAdd - * - * @param string $username desired user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminUserAdd($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) - { - $this->adminUserAddWithHttpInfo($username, $user_credentials, $contentType); - } - - /** - * Operation adminUserAddWithHttpInfo - * - * @param string $username desired user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminUserAddWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) - { - $request = $this->adminUserAddRequest($username, $user_credentials, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminUserAddAsync - * - * @param string $username desired user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserAddAsync($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) - { - return $this->adminUserAddAsyncWithHttpInfo($username, $user_credentials, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminUserAddAsyncWithHttpInfo - * - * @param string $username desired user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserAddAsyncWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) - { - $returnType = ''; - $request = $this->adminUserAddRequest($username, $user_credentials, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminUserAdd' - * - * @param string $username desired user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminUserAddRequest($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) - { - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling adminUserAdd' - ); - } - - // verify the required parameter 'user_credentials' is set - if ($user_credentials === null || (is_array($user_credentials) && count($user_credentials) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user_credentials when calling adminUserAdd' - ); - } - - - $resourcePath = '/api/v1/admin/user/{username}/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($user_credentials)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_credentials)); - } else { - $httpBody = $user_credentials; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminUserChangePassword - * - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminUserChangePassword($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) - { - $this->adminUserChangePasswordWithHttpInfo($username, $user_credentials, $contentType); - } - - /** - * Operation adminUserChangePasswordWithHttpInfo - * - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminUserChangePasswordWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) - { - $request = $this->adminUserChangePasswordRequest($username, $user_credentials, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminUserChangePasswordAsync - * - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserChangePasswordAsync($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) - { - return $this->adminUserChangePasswordAsyncWithHttpInfo($username, $user_credentials, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminUserChangePasswordAsyncWithHttpInfo - * - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserChangePasswordAsyncWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) - { - $returnType = ''; - $request = $this->adminUserChangePasswordRequest($username, $user_credentials, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminUserChangePassword' - * - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminUserChangePasswordRequest($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) - { - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling adminUserChangePassword' - ); - } - - // verify the required parameter 'user_credentials' is set - if ($user_credentials === null || (is_array($user_credentials) && count($user_credentials) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user_credentials when calling adminUserChangePassword' - ); - } - - - $resourcePath = '/api/v1/admin/user/{username}/change_password'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($user_credentials)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_credentials)); - } else { - $httpBody = $user_credentials; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminUserList - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\UserStatus[] - */ - public function adminUserList(string $contentType = self::contentTypes['adminUserList'][0]) - { - list($response) = $this->adminUserListWithHttpInfo($contentType); - return $response; - } - - /** - * Operation adminUserListWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\UserStatus[], HTTP status code, HTTP response headers (array of strings) - */ - public function adminUserListWithHttpInfo(string $contentType = self::contentTypes['adminUserList'][0]) - { - $request = $this->adminUserListRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\UserStatus[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\UserStatus[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\UserStatus[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\UserStatus[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminUserListAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserListAsync(string $contentType = self::contentTypes['adminUserList'][0]) - { - return $this->adminUserListAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminUserListAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserListAsyncWithHttpInfo(string $contentType = self::contentTypes['adminUserList'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; - $request = $this->adminUserListRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminUserList' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminUserListRequest(string $contentType = self::contentTypes['adminUserList'][0]) - { - - - $resourcePath = '/api/v1/admin/user/list'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminUserLogout - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function adminUserLogout($username, string $contentType = self::contentTypes['adminUserLogout'][0]) - { - $this->adminUserLogoutWithHttpInfo($username, $contentType); - } - - /** - * Operation adminUserLogoutWithHttpInfo - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function adminUserLogoutWithHttpInfo($username, string $contentType = self::contentTypes['adminUserLogout'][0]) - { - $request = $this->adminUserLogoutRequest($username, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation adminUserLogoutAsync - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserLogoutAsync($username, string $contentType = self::contentTypes['adminUserLogout'][0]) - { - return $this->adminUserLogoutAsyncWithHttpInfo($username, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminUserLogoutAsyncWithHttpInfo - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserLogoutAsyncWithHttpInfo($username, string $contentType = self::contentTypes['adminUserLogout'][0]) - { - $returnType = ''; - $request = $this->adminUserLogoutRequest($username, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminUserLogout' - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminUserLogoutRequest($username, string $contentType = self::contentTypes['adminUserLogout'][0]) - { - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling adminUserLogout' - ); - } - - - $resourcePath = '/api/v1/admin/user/{username}/logout'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation adminUserRemove - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\UserStatus[] - */ - public function adminUserRemove($username, string $contentType = self::contentTypes['adminUserRemove'][0]) - { - list($response) = $this->adminUserRemoveWithHttpInfo($username, $contentType); - return $response; - } - - /** - * Operation adminUserRemoveWithHttpInfo - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\UserStatus[], HTTP status code, HTTP response headers (array of strings) - */ - public function adminUserRemoveWithHttpInfo($username, string $contentType = self::contentTypes['adminUserRemove'][0]) - { - $request = $this->adminUserRemoveRequest($username, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 204: - if ('\Agnesoft\AgdbApi\Model\UserStatus[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\UserStatus[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\UserStatus[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 204: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\UserStatus[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation adminUserRemoveAsync - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserRemoveAsync($username, string $contentType = self::contentTypes['adminUserRemove'][0]) - { - return $this->adminUserRemoveAsyncWithHttpInfo($username, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation adminUserRemoveAsyncWithHttpInfo - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function adminUserRemoveAsyncWithHttpInfo($username, string $contentType = self::contentTypes['adminUserRemove'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; - $request = $this->adminUserRemoveRequest($username, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'adminUserRemove' - * - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function adminUserRemoveRequest($username, string $contentType = self::contentTypes['adminUserRemove'][0]) - { - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling adminUserRemove' - ); - } - - - $resourcePath = '/api/v1/admin/user/{username}/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation clusterStatus - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\ClusterStatus[] - */ - public function clusterStatus(string $contentType = self::contentTypes['clusterStatus'][0]) - { - list($response) = $this->clusterStatusWithHttpInfo($contentType); - return $response; - } - - /** - * Operation clusterStatusWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\ClusterStatus[], HTTP status code, HTTP response headers (array of strings) - */ - public function clusterStatusWithHttpInfo(string $contentType = self::contentTypes['clusterStatus'][0]) - { - $request = $this->clusterStatusRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\ClusterStatus[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\ClusterStatus[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ClusterStatus[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\ClusterStatus[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\ClusterStatus[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation clusterStatusAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function clusterStatusAsync(string $contentType = self::contentTypes['clusterStatus'][0]) - { - return $this->clusterStatusAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation clusterStatusAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function clusterStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['clusterStatus'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\ClusterStatus[]'; - $request = $this->clusterStatusRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'clusterStatus' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function clusterStatusRequest(string $contentType = self::contentTypes['clusterStatus'][0]) - { - - - $resourcePath = '/api/v1/cluster/status'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbAdd - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbAdd($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) - { - $this->dbAddWithHttpInfo($owner, $db, $db_type, $contentType); - } - - /** - * Operation dbAddWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbAddWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) - { - $request = $this->dbAddRequest($owner, $db, $db_type, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbAddAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbAddAsync($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) - { - return $this->dbAddAsyncWithHttpInfo($owner, $db, $db_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbAddAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbAddAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) - { - $returnType = ''; - $request = $this->dbAddRequest($owner, $db, $db_type, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbAdd' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbAddRequest($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbAdd' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbAdd' - ); - } - - // verify the required parameter 'db_type' is set - if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db_type when calling dbAdd' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $db_type, - 'db_type', // param base name - 'DbType', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbAudit - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\QueryAudit[] - */ - public function dbAudit($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) - { - list($response) = $this->dbAuditWithHttpInfo($owner, $db, $contentType); - return $response; - } - - /** - * Operation dbAuditWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\QueryAudit[], HTTP status code, HTTP response headers (array of strings) - */ - public function dbAuditWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) - { - $request = $this->dbAuditRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryAudit[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\QueryAudit[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation dbAuditAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbAuditAsync($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) - { - return $this->dbAuditAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbAuditAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbAuditAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; - $request = $this->dbAuditRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbAudit' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbAuditRequest($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbAudit' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbAudit' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/audit'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbBackup - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbBackup($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) - { - $this->dbBackupWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation dbBackupWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbBackupWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) - { - $request = $this->dbBackupRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbBackupAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbBackupAsync($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) - { - return $this->dbBackupAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbBackupAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbBackupAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) - { - $returnType = ''; - $request = $this->dbBackupRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbBackup' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbBackupRequest($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbBackup' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbBackup' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/backup'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbClear - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbResource $resource resource (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\ServerDatabase - */ - public function dbClear($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) - { - list($response) = $this->dbClearWithHttpInfo($owner, $db, $resource, $contentType); - return $response; - } - - /** - * Operation dbClearWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase, HTTP status code, HTTP response headers (array of strings) - */ - public function dbClearWithHttpInfo($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) - { - $request = $this->dbClearRequest($owner, $db, $resource, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 201: - if ('\Agnesoft\AgdbApi\Model\ServerDatabase' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\ServerDatabase' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 201: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\ServerDatabase', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation dbClearAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbClearAsync($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) - { - return $this->dbClearAsyncWithHttpInfo($owner, $db, $resource, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbClearAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbClearAsyncWithHttpInfo($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; - $request = $this->dbClearRequest($owner, $db, $resource, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbClear' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbClearRequest($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbClear' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbClear' - ); - } - - // verify the required parameter 'resource' is set - if ($resource === null || (is_array($resource) && count($resource) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $resource when calling dbClear' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/clear'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $resource, - 'resource', // param base name - 'DbResource', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbConvert - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbConvert($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) - { - $this->dbConvertWithHttpInfo($owner, $db, $db_type, $contentType); - } - - /** - * Operation dbConvertWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbConvertWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) - { - $request = $this->dbConvertRequest($owner, $db, $db_type, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbConvertAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbConvertAsync($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) - { - return $this->dbConvertAsyncWithHttpInfo($owner, $db, $db_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbConvertAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbConvertAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) - { - $returnType = ''; - $request = $this->dbConvertRequest($owner, $db, $db_type, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbConvert' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbConvertRequest($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbConvert' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbConvert' - ); - } - - // verify the required parameter 'db_type' is set - if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db_type when calling dbConvert' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/convert'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $db_type, - 'db_type', // param base name - 'DbType', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbCopy - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbCopy($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) - { - $this->dbCopyWithHttpInfo($owner, $db, $new_name, $contentType); - } - - /** - * Operation dbCopyWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbCopyWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) - { - $request = $this->dbCopyRequest($owner, $db, $new_name, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbCopyAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbCopyAsync($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) - { - return $this->dbCopyAsyncWithHttpInfo($owner, $db, $new_name, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbCopyAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbCopyAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) - { - $returnType = ''; - $request = $this->dbCopyRequest($owner, $db, $new_name, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbCopy' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbCopyRequest($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbCopy' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbCopy' - ); - } - - // verify the required parameter 'new_name' is set - if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $new_name when calling dbCopy' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/copy'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $new_name, - 'new_name', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbDelete - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbDelete($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) - { - $this->dbDeleteWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation dbDeleteWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbDeleteWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) - { - $request = $this->dbDeleteRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbDeleteAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbDeleteAsync($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) - { - return $this->dbDeleteAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbDeleteAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbDeleteAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) - { - $returnType = ''; - $request = $this->dbDeleteRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbDelete' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbDeleteRequest($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbDelete' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbDelete' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/delete'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbExec - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\QueryResult[] - */ - public function dbExec($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) - { - list($response) = $this->dbExecWithHttpInfo($owner, $db, $query_type, $contentType); - return $response; - } - - /** - * Operation dbExecWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\QueryResult[], HTTP status code, HTTP response headers (array of strings) - */ - public function dbExecWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) - { - $request = $this->dbExecRequest($owner, $db, $query_type, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\QueryResult[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\QueryResult[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryResult[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\QueryResult[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation dbExecAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbExecAsync($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) - { - return $this->dbExecAsyncWithHttpInfo($owner, $db, $query_type, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbExecAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbExecAsyncWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; - $request = $this->dbExecRequest($owner, $db, $query_type, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbExec' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbExecRequest($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbExec' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbExec' - ); - } - - // verify the required parameter 'query_type' is set - if ($query_type === null || (is_array($query_type) && count($query_type) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $query_type when calling dbExec' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/exec'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($query_type)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($query_type)); - } else { - $httpBody = $query_type; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbList - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\ServerDatabase[] - */ - public function dbList(string $contentType = self::contentTypes['dbList'][0]) - { - list($response) = $this->dbListWithHttpInfo($contentType); - return $response; - } - - /** - * Operation dbListWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase[], HTTP status code, HTTP response headers (array of strings) - */ - public function dbListWithHttpInfo(string $contentType = self::contentTypes['dbList'][0]) - { - $request = $this->dbListRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\ServerDatabase[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation dbListAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbListAsync(string $contentType = self::contentTypes['dbList'][0]) - { - return $this->dbListAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbListAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbListAsyncWithHttpInfo(string $contentType = self::contentTypes['dbList'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; - $request = $this->dbListRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbList' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbListRequest(string $contentType = self::contentTypes['dbList'][0]) - { - - - $resourcePath = '/api/v1/db/list'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbOptimize - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\ServerDatabase - */ - public function dbOptimize($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) - { - list($response) = $this->dbOptimizeWithHttpInfo($owner, $db, $contentType); - return $response; - } - - /** - * Operation dbOptimizeWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase, HTTP status code, HTTP response headers (array of strings) - */ - public function dbOptimizeWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) - { - $request = $this->dbOptimizeRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\ServerDatabase' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\ServerDatabase' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\ServerDatabase', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation dbOptimizeAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbOptimizeAsync($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) - { - return $this->dbOptimizeAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbOptimizeAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbOptimizeAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; - $request = $this->dbOptimizeRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbOptimize' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbOptimizeRequest($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbOptimize' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbOptimize' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/optimize'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbRemove - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbRemove($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) - { - $this->dbRemoveWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation dbRemoveWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbRemoveWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) - { - $request = $this->dbRemoveRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbRemoveAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbRemoveAsync($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) - { - return $this->dbRemoveAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbRemoveAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbRemoveAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) - { - $returnType = ''; - $request = $this->dbRemoveRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbRemove' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbRemoveRequest($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbRemove' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbRemove' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'DELETE', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbRename - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbRename($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) - { - $this->dbRenameWithHttpInfo($owner, $db, $new_name, $contentType); - } - - /** - * Operation dbRenameWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbRenameWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) - { - $request = $this->dbRenameRequest($owner, $db, $new_name, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbRenameAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbRenameAsync($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) - { - return $this->dbRenameAsyncWithHttpInfo($owner, $db, $new_name, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbRenameAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbRenameAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) - { - $returnType = ''; - $request = $this->dbRenameRequest($owner, $db, $new_name, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbRename' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $new_name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbRenameRequest($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbRename' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbRename' - ); - } - - // verify the required parameter 'new_name' is set - if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $new_name when calling dbRename' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/rename'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $new_name, - 'new_name', // param base name - 'string', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbRestore - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbRestore($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) - { - $this->dbRestoreWithHttpInfo($owner, $db, $contentType); - } - - /** - * Operation dbRestoreWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbRestoreWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) - { - $request = $this->dbRestoreRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbRestoreAsync - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbRestoreAsync($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) - { - return $this->dbRestoreAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbRestoreAsyncWithHttpInfo - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbRestoreAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) - { - $returnType = ''; - $request = $this->dbRestoreRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbRestore' - * - * @param string $owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbRestoreRequest($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbRestore' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbRestore' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/restore'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbUserAdd - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbUserAdd($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) - { - $this->dbUserAddWithHttpInfo($owner, $db, $username, $db_role, $contentType); - } - - /** - * Operation dbUserAddWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbUserAddWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) - { - $request = $this->dbUserAddRequest($owner, $db, $username, $db_role, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbUserAddAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbUserAddAsync($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) - { - return $this->dbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbUserAddAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) - { - $returnType = ''; - $request = $this->dbUserAddRequest($owner, $db, $username, $db_role, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbUserAdd' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbUserAddRequest($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbUserAdd' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbUserAdd' - ); - } - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling dbUserAdd' - ); - } - - // verify the required parameter 'db_role' is set - if ($db_role === null || (is_array($db_role) && count($db_role) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db_role when calling dbUserAdd' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/user/{username}/add'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - // query params - $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( - $db_role, - 'db_role', // param base name - 'DbUserRole', // openApiType - 'form', // style - true, // explode - true // required - ) ?? []); - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbUserList - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\DbUser[] - */ - public function dbUserList($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) - { - list($response) = $this->dbUserListWithHttpInfo($owner, $db, $contentType); - return $response; - } - - /** - * Operation dbUserListWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\DbUser[], HTTP status code, HTTP response headers (array of strings) - */ - public function dbUserListWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) - { - $request = $this->dbUserListRequest($owner, $db, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\DbUser[]' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\DbUser[]' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\DbUser[]', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\DbUser[]', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation dbUserListAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbUserListAsync($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) - { - return $this->dbUserListAsyncWithHttpInfo($owner, $db, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbUserListAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbUserListAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; - $request = $this->dbUserListRequest($owner, $db, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbUserList' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbUserListRequest($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbUserList' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbUserList' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/user/list'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation dbUserRemove - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function dbUserRemove($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) - { - $this->dbUserRemoveWithHttpInfo($owner, $db, $username, $contentType); - } - - /** - * Operation dbUserRemoveWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function dbUserRemoveWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) - { - $request = $this->dbUserRemoveRequest($owner, $db, $username, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation dbUserRemoveAsync - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbUserRemoveAsync($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) - { - return $this->dbUserRemoveAsyncWithHttpInfo($owner, $db, $username, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation dbUserRemoveAsyncWithHttpInfo - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function dbUserRemoveAsyncWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) - { - $returnType = ''; - $request = $this->dbUserRemoveRequest($owner, $db, $username, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'dbUserRemove' - * - * @param string $owner db owner user name (required) - * @param string $db db name (required) - * @param string $username user name (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function dbUserRemoveRequest($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) - { - - // verify the required parameter 'owner' is set - if ($owner === null || (is_array($owner) && count($owner) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $owner when calling dbUserRemove' - ); - } - - // verify the required parameter 'db' is set - if ($db === null || (is_array($db) && count($db) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $db when calling dbUserRemove' - ); - } - - // verify the required parameter 'username' is set - if ($username === null || (is_array($username) && count($username) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $username when calling dbUserRemove' - ); - } - - - $resourcePath = '/api/v1/db/{owner}/{db}/user/{username}/remove'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - // path params - if ($owner !== null) { - $resourcePath = str_replace( - '{' . 'owner' . '}', - ObjectSerializer::toPathValue($owner), - $resourcePath - ); - } - // path params - if ($db !== null) { - $resourcePath = str_replace( - '{' . 'db' . '}', - ObjectSerializer::toPathValue($db), - $resourcePath - ); - } - // path params - if ($username !== null) { - $resourcePath = str_replace( - '{' . 'username' . '}', - ObjectSerializer::toPathValue($username), - $resourcePath - ); - } - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation status - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function status(string $contentType = self::contentTypes['status'][0]) - { - $this->statusWithHttpInfo($contentType); - } - - /** - * Operation statusWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function statusWithHttpInfo(string $contentType = self::contentTypes['status'][0]) - { - $request = $this->statusRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation statusAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function statusAsync(string $contentType = self::contentTypes['status'][0]) - { - return $this->statusAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation statusAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function statusAsyncWithHttpInfo(string $contentType = self::contentTypes['status'][0]) - { - $returnType = ''; - $request = $this->statusRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'status' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function statusRequest(string $contentType = self::contentTypes['status'][0]) - { - - - $resourcePath = '/api/v1/status'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation userChangePassword - * - * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password change_password (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function userChangePassword($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) - { - $this->userChangePasswordWithHttpInfo($change_password, $contentType); - } - - /** - * Operation userChangePasswordWithHttpInfo - * - * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function userChangePasswordWithHttpInfo($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) - { - $request = $this->userChangePasswordRequest($change_password, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation userChangePasswordAsync - * - * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userChangePasswordAsync($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) - { - return $this->userChangePasswordAsyncWithHttpInfo($change_password, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation userChangePasswordAsyncWithHttpInfo - * - * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userChangePasswordAsyncWithHttpInfo($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) - { - $returnType = ''; - $request = $this->userChangePasswordRequest($change_password, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'userChangePassword' - * - * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function userChangePasswordRequest($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) - { - - // verify the required parameter 'change_password' is set - if ($change_password === null || (is_array($change_password) && count($change_password) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $change_password when calling userChangePassword' - ); - } - - - $resourcePath = '/api/v1/user/change_password'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($change_password)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($change_password)); - } else { - $httpBody = $change_password; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'PUT', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation userLogin - * - * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login user_login (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return string - */ - public function userLogin($user_login, string $contentType = self::contentTypes['userLogin'][0]) - { - list($response) = $this->userLoginWithHttpInfo($user_login, $contentType); - return $response; - } - - /** - * Operation userLoginWithHttpInfo - * - * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of string, HTTP status code, HTTP response headers (array of strings) - */ - public function userLoginWithHttpInfo($user_login, string $contentType = self::contentTypes['userLogin'][0]) - { - $request = $this->userLoginRequest($user_login, $contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('string' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('string' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, 'string', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = 'string'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - 'string', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation userLoginAsync - * - * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userLoginAsync($user_login, string $contentType = self::contentTypes['userLogin'][0]) - { - return $this->userLoginAsyncWithHttpInfo($user_login, $contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation userLoginAsyncWithHttpInfo - * - * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userLoginAsyncWithHttpInfo($user_login, string $contentType = self::contentTypes['userLogin'][0]) - { - $returnType = 'string'; - $request = $this->userLoginRequest($user_login, $contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'userLogin' - * - * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function userLoginRequest($user_login, string $contentType = self::contentTypes['userLogin'][0]) - { - - // verify the required parameter 'user_login' is set - if ($user_login === null || (is_array($user_login) && count($user_login) === 0)) { - throw new \InvalidArgumentException( - 'Missing the required parameter $user_login when calling userLogin' - ); - } - - - $resourcePath = '/api/v1/user/login'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['text/plain', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (isset($user_login)) { - if (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the body - $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_login)); - } else { - $httpBody = $user_login; - } - } elseif (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation userLogout - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return void - */ - public function userLogout(string $contentType = self::contentTypes['userLogout'][0]) - { - $this->userLogoutWithHttpInfo($contentType); - } - - /** - * Operation userLogoutWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of null, HTTP status code, HTTP response headers (array of strings) - */ - public function userLogoutWithHttpInfo(string $contentType = self::contentTypes['userLogout'][0]) - { - $request = $this->userLogoutRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - return [null, $statusCode, $response->getHeaders()]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - } - throw $e; - } - } - - /** - * Operation userLogoutAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userLogoutAsync(string $contentType = self::contentTypes['userLogout'][0]) - { - return $this->userLogoutAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation userLogoutAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userLogoutAsyncWithHttpInfo(string $contentType = self::contentTypes['userLogout'][0]) - { - $returnType = ''; - $request = $this->userLogoutRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - return [null, $response->getStatusCode(), $response->getHeaders()]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'userLogout' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function userLogoutRequest(string $contentType = self::contentTypes['userLogout'][0]) - { - - - $resourcePath = '/api/v1/user/logout'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - [], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'POST', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Operation userStatus - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return \Agnesoft\AgdbApi\Model\UserStatus - */ - public function userStatus(string $contentType = self::contentTypes['userStatus'][0]) - { - list($response) = $this->userStatusWithHttpInfo($contentType); - return $response; - } - - /** - * Operation userStatusWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation - * - * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format - * @throws \InvalidArgumentException - * @return array of \Agnesoft\AgdbApi\Model\UserStatus, HTTP status code, HTTP response headers (array of strings) - */ - public function userStatusWithHttpInfo(string $contentType = self::contentTypes['userStatus'][0]) - { - $request = $this->userStatusRequest($contentType); - - try { - $options = $this->createHttpClientOption(); - try { - $response = $this->client->send($request, $options); - } catch (RequestException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - $e->getResponse() ? $e->getResponse()->getHeaders() : null, - $e->getResponse() ? (string) $e->getResponse()->getBody() : null - ); - } catch (ConnectException $e) { - throw new ApiException( - "[{$e->getCode()}] {$e->getMessage()}", - (int) $e->getCode(), - null, - null - ); - } - - $statusCode = $response->getStatusCode(); - - - switch($statusCode) { - case 200: - if ('\Agnesoft\AgdbApi\Model\UserStatus' === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ('\Agnesoft\AgdbApi\Model\UserStatus' !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\UserStatus', []), - $response->getStatusCode(), - $response->getHeaders() - ]; - } - - if ($statusCode < 200 || $statusCode > 299) { - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - (string) $request->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - - $returnType = '\Agnesoft\AgdbApi\Model\UserStatus'; - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - try { - $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); - } catch (\JsonException $exception) { - throw new ApiException( - sprintf( - 'Error JSON decoding server response (%s)', - $request->getUri() - ), - $statusCode, - $response->getHeaders(), - $content - ); - } - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - - } catch (ApiException $e) { - switch ($e->getCode()) { - case 200: - $data = ObjectSerializer::deserialize( - $e->getResponseBody(), - '\Agnesoft\AgdbApi\Model\UserStatus', - $e->getResponseHeaders() - ); - $e->setResponseObject($data); - break; - } - throw $e; - } - } - - /** - * Operation userStatusAsync - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userStatusAsync(string $contentType = self::contentTypes['userStatus'][0]) - { - return $this->userStatusAsyncWithHttpInfo($contentType) - ->then( - function ($response) { - return $response[0]; - } - ); - } - - /** - * Operation userStatusAsyncWithHttpInfo - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Promise\PromiseInterface - */ - public function userStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['userStatus'][0]) - { - $returnType = '\Agnesoft\AgdbApi\Model\UserStatus'; - $request = $this->userStatusRequest($contentType); - - return $this->client - ->sendAsync($request, $this->createHttpClientOption()) - ->then( - function ($response) use ($returnType) { - if ($returnType === '\SplFileObject') { - $content = $response->getBody(); //stream goes to serializer - } else { - $content = (string) $response->getBody(); - if ($returnType !== 'string') { - $content = json_decode($content); - } - } - - return [ - ObjectSerializer::deserialize($content, $returnType, []), - $response->getStatusCode(), - $response->getHeaders() - ]; - }, - function ($exception) { - $response = $exception->getResponse(); - $statusCode = $response->getStatusCode(); - throw new ApiException( - sprintf( - '[%d] Error connecting to the API (%s)', - $statusCode, - $exception->getRequest()->getUri() - ), - $statusCode, - $response->getHeaders(), - (string) $response->getBody() - ); - } - ); - } - - /** - * Create request for operation 'userStatus' - * - * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation - * - * @throws \InvalidArgumentException - * @return \GuzzleHttp\Psr7\Request - */ - public function userStatusRequest(string $contentType = self::contentTypes['userStatus'][0]) - { - - - $resourcePath = '/api/v1/user/status'; - $formParams = []; - $queryParams = []; - $headerParams = []; - $httpBody = ''; - $multipart = false; - - - - - - $headers = $this->headerSelector->selectHeaders( - ['application/json', ], - $contentType, - $multipart - ); - - // for model (json/xml) - if (count($formParams) > 0) { - if ($multipart) { - $multipartContents = []; - foreach ($formParams as $formParamName => $formParamValue) { - $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; - foreach ($formParamValueItems as $formParamValueItem) { - $multipartContents[] = [ - 'name' => $formParamName, - 'contents' => $formParamValueItem - ]; - } - } - // for HTTP post (form) - $httpBody = new MultipartStream($multipartContents); - - } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { - # if Content-Type contains "application/json", json_encode the form parameters - $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); - } else { - // for HTTP post (form) - $httpBody = ObjectSerializer::buildQuery($formParams); - } - } - - // this endpoint requires Bearer authentication (access token) - if (!empty($this->config->getAccessToken())) { - $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); - } - - $defaultHeaders = []; - if ($this->config->getUserAgent()) { - $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); - } - - $headers = array_merge( - $defaultHeaders, - $headerParams, - $headers - ); - - $operationHost = $this->config->getHost(); - $query = ObjectSerializer::buildQuery($queryParams); - return new Request( - 'GET', - $operationHost . $resourcePath . ($query ? "?{$query}" : ''), - $headers, - $httpBody - ); - } - - /** - * Create http client option - * - * @throws \RuntimeException on file opening failure - * @return array of http client options - */ - protected function createHttpClientOption() - { - $options = []; - if ($this->config->getDebug()) { - $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); - if (!$options[RequestOptions::DEBUG]) { - throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); - } - } - - return $options; - } -} diff --git a/agdb_api/php/lib/ApiException.php b/agdb_api/php/lib/ApiException.php deleted file mode 100644 index 0db08360..00000000 --- a/agdb_api/php/lib/ApiException.php +++ /dev/null @@ -1,119 +0,0 @@ -responseHeaders = $responseHeaders; - $this->responseBody = $responseBody; - } - - /** - * Gets the HTTP response header - * - * @return string[][]|null HTTP response header - */ - public function getResponseHeaders() - { - return $this->responseHeaders; - } - - /** - * Gets the HTTP body of the server response either as Json or string - * - * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string - */ - public function getResponseBody() - { - return $this->responseBody; - } - - /** - * Sets the deserialized response object (during deserialization) - * - * @param mixed $obj Deserialized response object - * - * @return void - */ - public function setResponseObject($obj) - { - $this->responseObject = $obj; - } - - /** - * Gets the deserialized response object (during deserialization) - * - * @return mixed the deserialized response object - */ - public function getResponseObject() - { - return $this->responseObject; - } -} diff --git a/agdb_api/php/lib/Configuration.php b/agdb_api/php/lib/Configuration.php deleted file mode 100644 index 683a7c91..00000000 --- a/agdb_api/php/lib/Configuration.php +++ /dev/null @@ -1,532 +0,0 @@ -tempFolderPath = sys_get_temp_dir(); - } - - /** - * Sets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $key API key or token - * - * @return $this - */ - public function setApiKey($apiKeyIdentifier, $key) - { - $this->apiKeys[$apiKeyIdentifier] = $key; - return $this; - } - - /** - * Gets API key - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string API key or token - */ - public function getApiKey($apiKeyIdentifier) - { - return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; - } - - /** - * Sets the prefix for API key (e.g. Bearer) - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * @param string $prefix API key prefix, e.g. Bearer - * - * @return $this - */ - public function setApiKeyPrefix($apiKeyIdentifier, $prefix) - { - $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; - return $this; - } - - /** - * Gets API key prefix - * - * @param string $apiKeyIdentifier API key identifier (authentication scheme) - * - * @return null|string - */ - public function getApiKeyPrefix($apiKeyIdentifier) - { - return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; - } - - /** - * Sets the access token for OAuth - * - * @param string $accessToken Token for OAuth - * - * @return $this - */ - public function setAccessToken($accessToken) - { - $this->accessToken = $accessToken; - return $this; - } - - /** - * Gets the access token for OAuth - * - * @return string Access token for OAuth - */ - public function getAccessToken() - { - return $this->accessToken; - } - - /** - * Sets boolean format for query string. - * - * @param string $booleanFormat Boolean format for query string - * - * @return $this - */ - public function setBooleanFormatForQueryString(string $booleanFormat) - { - $this->booleanFormatForQueryString = $booleanFormat; - - return $this; - } - - /** - * Gets boolean format for query string. - * - * @return string Boolean format for query string - */ - public function getBooleanFormatForQueryString(): string - { - return $this->booleanFormatForQueryString; - } - - /** - * Sets the username for HTTP basic authentication - * - * @param string $username Username for HTTP basic authentication - * - * @return $this - */ - public function setUsername($username) - { - $this->username = $username; - return $this; - } - - /** - * Gets the username for HTTP basic authentication - * - * @return string Username for HTTP basic authentication - */ - public function getUsername() - { - return $this->username; - } - - /** - * Sets the password for HTTP basic authentication - * - * @param string $password Password for HTTP basic authentication - * - * @return $this - */ - public function setPassword($password) - { - $this->password = $password; - return $this; - } - - /** - * Gets the password for HTTP basic authentication - * - * @return string Password for HTTP basic authentication - */ - public function getPassword() - { - return $this->password; - } - - /** - * Sets the host - * - * @param string $host Host - * - * @return $this - */ - public function setHost($host) - { - $this->host = $host; - return $this; - } - - /** - * Gets the host - * - * @return string Host - */ - public function getHost() - { - return $this->host; - } - - /** - * Sets the user agent of the api client - * - * @param string $userAgent the user agent of the api client - * - * @throws \InvalidArgumentException - * @return $this - */ - public function setUserAgent($userAgent) - { - if (!is_string($userAgent)) { - throw new \InvalidArgumentException('User-agent must be a string.'); - } - - $this->userAgent = $userAgent; - return $this; - } - - /** - * Gets the user agent of the api client - * - * @return string user agent - */ - public function getUserAgent() - { - return $this->userAgent; - } - - /** - * Sets debug flag - * - * @param bool $debug Debug flag - * - * @return $this - */ - public function setDebug($debug) - { - $this->debug = $debug; - return $this; - } - - /** - * Gets the debug flag - * - * @return bool - */ - public function getDebug() - { - return $this->debug; - } - - /** - * Sets the debug file - * - * @param string $debugFile Debug file - * - * @return $this - */ - public function setDebugFile($debugFile) - { - $this->debugFile = $debugFile; - return $this; - } - - /** - * Gets the debug file - * - * @return string - */ - public function getDebugFile() - { - return $this->debugFile; - } - - /** - * Sets the temp folder path - * - * @param string $tempFolderPath Temp folder path - * - * @return $this - */ - public function setTempFolderPath($tempFolderPath) - { - $this->tempFolderPath = $tempFolderPath; - return $this; - } - - /** - * Gets the temp folder path - * - * @return string Temp folder path - */ - public function getTempFolderPath() - { - return $this->tempFolderPath; - } - - /** - * Gets the default configuration instance - * - * @return Configuration - */ - public static function getDefaultConfiguration() - { - if (self::$defaultConfiguration === null) { - self::$defaultConfiguration = new Configuration(); - } - - return self::$defaultConfiguration; - } - - /** - * Sets the default configuration instance - * - * @param Configuration $config An instance of the Configuration Object - * - * @return void - */ - public static function setDefaultConfiguration(Configuration $config) - { - self::$defaultConfiguration = $config; - } - - /** - * Gets the essential information for debugging - * - * @return string The report for debugging - */ - public static function toDebugReport() - { - $report = 'PHP SDK (Agnesoft\AgdbApi) Debug Report:' . PHP_EOL; - $report .= ' OS: ' . php_uname() . PHP_EOL; - $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; - $report .= ' The version of the OpenAPI document: 0.9.2' . PHP_EOL; - $report .= ' SDK Package Version: 0.7.2' . PHP_EOL; - $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; - - return $report; - } - - /** - * Get API key (with prefix if set) - * - * @param string $apiKeyIdentifier name of apikey - * - * @return null|string API key with the prefix - */ - public function getApiKeyWithPrefix($apiKeyIdentifier) - { - $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); - $apiKey = $this->getApiKey($apiKeyIdentifier); - - if ($apiKey === null) { - return null; - } - - if ($prefix === null) { - $keyWithPrefix = $apiKey; - } else { - $keyWithPrefix = $prefix . ' ' . $apiKey; - } - - return $keyWithPrefix; - } - - /** - * Returns an array of host settings - * - * @return array an array of host settings - */ - public function getHostSettings() - { - return [ - [ - "url" => "http://localhost:3000", - "description" => "Local server", - ] - ]; - } - - /** - * Returns URL based on host settings, index and variables - * - * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients - * @param int $hostIndex index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) - { - if (null === $variables) { - $variables = []; - } - - // check array index out of bound - if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { - throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); - } - - $host = $hostSettings[$hostIndex]; - $url = $host["url"]; - - // go through variable and assign a value - foreach ($host["variables"] ?? [] as $name => $variable) { - if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user - if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum - $url = str_replace("{".$name."}", $variables[$name], $url); - } else { - throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); - } - } else { - // use default value - $url = str_replace("{".$name."}", $variable["default_value"], $url); - } - } - - return $url; - } - - /** - * Returns URL based on the index and variables - * - * @param int $index index of the host settings - * @param array|null $variables hash of variable and the corresponding value (optional) - * @return string URL based on host settings - */ - public function getHostFromSettings($index, $variables = null) - { - return self::getHostString($this->getHostSettings(), $index, $variables); - } -} diff --git a/agdb_api/php/lib/HeaderSelector.php b/agdb_api/php/lib/HeaderSelector.php deleted file mode 100644 index fdd01928..00000000 --- a/agdb_api/php/lib/HeaderSelector.php +++ /dev/null @@ -1,273 +0,0 @@ -selectAcceptHeader($accept); - if ($accept !== null) { - $headers['Accept'] = $accept; - } - - if (!$isMultipart) { - if($contentType === '') { - $contentType = 'application/json'; - } - - $headers['Content-Type'] = $contentType; - } - - return $headers; - } - - /** - * Return the header 'Accept' based on an array of Accept provided. - * - * @param string[] $accept Array of header - * - * @return null|string Accept (e.g. application/json) - */ - private function selectAcceptHeader(array $accept): ?string - { - # filter out empty entries - $accept = array_filter($accept); - - if (count($accept) === 0) { - return null; - } - - # If there's only one Accept header, just use it - if (count($accept) === 1) { - return reset($accept); - } - - # If none of the available Accept headers is of type "json", then just use all them - $headersWithJson = $this->selectJsonMimeList($accept); - if (count($headersWithJson) === 0) { - return implode(',', $accept); - } - - # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, - # to give the highest priority to json-like headers - recalculating the existing ones, if needed - return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); - } - - /** - * Detects whether a string contains a valid JSON mime type - * - * @param string $searchString - * @return bool - */ - public function isJsonMime(string $searchString): bool - { - return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; - } - - /** - * Select all items from a list containing a JSON mime type - * - * @param array $mimeList - * @return array - */ - private function selectJsonMimeList(array $mimeList): array { - $jsonMimeList = []; - foreach ($mimeList as $mime) { - if($this->isJsonMime($mime)) { - $jsonMimeList[] = $mime; - } - } - return $jsonMimeList; - } - - - /** - * Create an Accept header string from the given "Accept" headers array, recalculating all weights - * - * @param string[] $accept Array of Accept Headers - * @param string[] $headersWithJson Array of Accept Headers of type "json" - * - * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") - */ - private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string - { - $processedHeaders = [ - 'withApplicationJson' => [], - 'withJson' => [], - 'withoutJson' => [], - ]; - - foreach ($accept as $header) { - - $headerData = $this->getHeaderAndWeight($header); - - if (stripos($headerData['header'], 'application/json') === 0) { - $processedHeaders['withApplicationJson'][] = $headerData; - } elseif (in_array($header, $headersWithJson, true)) { - $processedHeaders['withJson'][] = $headerData; - } else { - $processedHeaders['withoutJson'][] = $headerData; - } - } - - $acceptHeaders = []; - $currentWeight = 1000; - - $hasMoreThan28Headers = count($accept) > 28; - - foreach($processedHeaders as $headers) { - if (count($headers) > 0) { - $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); - } - } - - $acceptHeaders = array_merge(...$acceptHeaders); - - return implode(',', $acceptHeaders); - } - - /** - * Given an Accept header, returns an associative array splitting the header and its weight - * - * @param string $header "Accept" Header - * - * @return array with the header and its weight - */ - private function getHeaderAndWeight(string $header): array - { - # matches headers with weight, splitting the header and the weight in $outputArray - if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { - $headerData = [ - 'header' => $outputArray[1], - 'weight' => (int)($outputArray[2] * 1000), - ]; - } else { - $headerData = [ - 'header' => trim($header), - 'weight' => 1000, - ]; - } - - return $headerData; - } - - /** - * @param array[] $headers - * @param float $currentWeight - * @param bool $hasMoreThan28Headers - * @return string[] array of adjusted "Accept" headers - */ - private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array - { - usort($headers, function (array $a, array $b) { - return $b['weight'] - $a['weight']; - }); - - $acceptHeaders = []; - foreach ($headers as $index => $header) { - if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) - { - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - } - - $weight = $currentWeight; - - $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); - } - - $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); - - return $acceptHeaders; - } - - /** - * @param string $header - * @param int $weight - * @return string - */ - private function buildAcceptHeader(string $header, int $weight): string - { - if($weight === 1000) { - return $header; - } - - return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); - } - - /** - * Calculate the next weight, based on the current one. - * - * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the - * following formula: - * - * next weight = current weight - 10 ^ (floor(log(current weight - 1))) - * - * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) - * - * Starting from 1000, this generates the following series: - * - * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 - * - * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works - * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 - * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. - * - * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) - * @param bool $hasMoreThan28Headers - * @return int - */ - public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int - { - if ($currentWeight <= 1) { - return 1; - } - - if ($hasMoreThan28Headers) { - return $currentWeight - 1; - } - - return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); - } -} diff --git a/agdb_api/php/lib/Model/AdminStatus.php b/agdb_api/php/lib/Model/AdminStatus.php deleted file mode 100644 index a7ca6687..00000000 --- a/agdb_api/php/lib/Model/AdminStatus.php +++ /dev/null @@ -1,605 +0,0 @@ - - */ -class AdminStatus implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'AdminStatus'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'dbs' => 'int', - 'logged_in_users' => 'int', - 'size' => 'int', - 'uptime' => 'int', - 'users' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'dbs' => 'int64', - 'logged_in_users' => 'int64', - 'size' => 'int64', - 'uptime' => 'int64', - 'users' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'dbs' => false, - 'logged_in_users' => false, - 'size' => false, - 'uptime' => false, - 'users' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'dbs' => 'dbs', - 'logged_in_users' => 'logged_in_users', - 'size' => 'size', - 'uptime' => 'uptime', - 'users' => 'users' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'dbs' => 'setDbs', - 'logged_in_users' => 'setLoggedInUsers', - 'size' => 'setSize', - 'uptime' => 'setUptime', - 'users' => 'setUsers' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'dbs' => 'getDbs', - 'logged_in_users' => 'getLoggedInUsers', - 'size' => 'getSize', - 'uptime' => 'getUptime', - 'users' => 'getUsers' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('dbs', $data ?? [], null); - $this->setIfExists('logged_in_users', $data ?? [], null); - $this->setIfExists('size', $data ?? [], null); - $this->setIfExists('uptime', $data ?? [], null); - $this->setIfExists('users', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['dbs'] === null) { - $invalidProperties[] = "'dbs' can't be null"; - } - if (($this->container['dbs'] < 0)) { - $invalidProperties[] = "invalid value for 'dbs', must be bigger than or equal to 0."; - } - - if ($this->container['logged_in_users'] === null) { - $invalidProperties[] = "'logged_in_users' can't be null"; - } - if (($this->container['logged_in_users'] < 0)) { - $invalidProperties[] = "invalid value for 'logged_in_users', must be bigger than or equal to 0."; - } - - if ($this->container['size'] === null) { - $invalidProperties[] = "'size' can't be null"; - } - if (($this->container['size'] < 0)) { - $invalidProperties[] = "invalid value for 'size', must be bigger than or equal to 0."; - } - - if ($this->container['uptime'] === null) { - $invalidProperties[] = "'uptime' can't be null"; - } - if (($this->container['uptime'] < 0)) { - $invalidProperties[] = "invalid value for 'uptime', must be bigger than or equal to 0."; - } - - if ($this->container['users'] === null) { - $invalidProperties[] = "'users' can't be null"; - } - if (($this->container['users'] < 0)) { - $invalidProperties[] = "invalid value for 'users', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets dbs - * - * @return int - */ - public function getDbs() - { - return $this->container['dbs']; - } - - /** - * Sets dbs - * - * @param int $dbs dbs - * - * @return self - */ - public function setDbs($dbs) - { - if (is_null($dbs)) { - throw new \InvalidArgumentException('non-nullable dbs cannot be null'); - } - - if (($dbs < 0)) { - throw new \InvalidArgumentException('invalid value for $dbs when calling AdminStatus., must be bigger than or equal to 0.'); - } - - $this->container['dbs'] = $dbs; - - return $this; - } - - /** - * Gets logged_in_users - * - * @return int - */ - public function getLoggedInUsers() - { - return $this->container['logged_in_users']; - } - - /** - * Sets logged_in_users - * - * @param int $logged_in_users logged_in_users - * - * @return self - */ - public function setLoggedInUsers($logged_in_users) - { - if (is_null($logged_in_users)) { - throw new \InvalidArgumentException('non-nullable logged_in_users cannot be null'); - } - - if (($logged_in_users < 0)) { - throw new \InvalidArgumentException('invalid value for $logged_in_users when calling AdminStatus., must be bigger than or equal to 0.'); - } - - $this->container['logged_in_users'] = $logged_in_users; - - return $this; - } - - /** - * Gets size - * - * @return int - */ - public function getSize() - { - return $this->container['size']; - } - - /** - * Sets size - * - * @param int $size size - * - * @return self - */ - public function setSize($size) - { - if (is_null($size)) { - throw new \InvalidArgumentException('non-nullable size cannot be null'); - } - - if (($size < 0)) { - throw new \InvalidArgumentException('invalid value for $size when calling AdminStatus., must be bigger than or equal to 0.'); - } - - $this->container['size'] = $size; - - return $this; - } - - /** - * Gets uptime - * - * @return int - */ - public function getUptime() - { - return $this->container['uptime']; - } - - /** - * Sets uptime - * - * @param int $uptime uptime - * - * @return self - */ - public function setUptime($uptime) - { - if (is_null($uptime)) { - throw new \InvalidArgumentException('non-nullable uptime cannot be null'); - } - - if (($uptime < 0)) { - throw new \InvalidArgumentException('invalid value for $uptime when calling AdminStatus., must be bigger than or equal to 0.'); - } - - $this->container['uptime'] = $uptime; - - return $this; - } - - /** - * Gets users - * - * @return int - */ - public function getUsers() - { - return $this->container['users']; - } - - /** - * Sets users - * - * @param int $users users - * - * @return self - */ - public function setUsers($users) - { - if (is_null($users)) { - throw new \InvalidArgumentException('non-nullable users cannot be null'); - } - - if (($users < 0)) { - throw new \InvalidArgumentException('invalid value for $users when calling AdminStatus., must be bigger than or equal to 0.'); - } - - $this->container['users'] = $users; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ChangePassword.php b/agdb_api/php/lib/Model/ChangePassword.php deleted file mode 100644 index 1b651108..00000000 --- a/agdb_api/php/lib/Model/ChangePassword.php +++ /dev/null @@ -1,449 +0,0 @@ - - */ -class ChangePassword implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ChangePassword'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'new_password' => 'string', - 'password' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'new_password' => null, - 'password' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'new_password' => false, - 'password' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'new_password' => 'new_password', - 'password' => 'password' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'new_password' => 'setNewPassword', - 'password' => 'setPassword' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'new_password' => 'getNewPassword', - 'password' => 'getPassword' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('new_password', $data ?? [], null); - $this->setIfExists('password', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['new_password'] === null) { - $invalidProperties[] = "'new_password' can't be null"; - } - if ($this->container['password'] === null) { - $invalidProperties[] = "'password' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets new_password - * - * @return string - */ - public function getNewPassword() - { - return $this->container['new_password']; - } - - /** - * Sets new_password - * - * @param string $new_password new_password - * - * @return self - */ - public function setNewPassword($new_password) - { - if (is_null($new_password)) { - throw new \InvalidArgumentException('non-nullable new_password cannot be null'); - } - $this->container['new_password'] = $new_password; - - return $this; - } - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password password - * - * @return self - */ - public function setPassword($password) - { - if (is_null($password)) { - throw new \InvalidArgumentException('non-nullable password cannot be null'); - } - $this->container['password'] = $password; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ClusterStatus.php b/agdb_api/php/lib/Model/ClusterStatus.php deleted file mode 100644 index cd500102..00000000 --- a/agdb_api/php/lib/Model/ClusterStatus.php +++ /dev/null @@ -1,578 +0,0 @@ - - */ -class ClusterStatus implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ClusterStatus'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'address' => 'string', - 'commit' => 'int', - 'leader' => 'bool', - 'status' => 'bool', - 'term' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'address' => null, - 'commit' => 'int64', - 'leader' => null, - 'status' => null, - 'term' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'address' => false, - 'commit' => false, - 'leader' => false, - 'status' => false, - 'term' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'address' => 'address', - 'commit' => 'commit', - 'leader' => 'leader', - 'status' => 'status', - 'term' => 'term' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'address' => 'setAddress', - 'commit' => 'setCommit', - 'leader' => 'setLeader', - 'status' => 'setStatus', - 'term' => 'setTerm' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'address' => 'getAddress', - 'commit' => 'getCommit', - 'leader' => 'getLeader', - 'status' => 'getStatus', - 'term' => 'getTerm' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('address', $data ?? [], null); - $this->setIfExists('commit', $data ?? [], null); - $this->setIfExists('leader', $data ?? [], null); - $this->setIfExists('status', $data ?? [], null); - $this->setIfExists('term', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['address'] === null) { - $invalidProperties[] = "'address' can't be null"; - } - if ($this->container['commit'] === null) { - $invalidProperties[] = "'commit' can't be null"; - } - if (($this->container['commit'] < 0)) { - $invalidProperties[] = "invalid value for 'commit', must be bigger than or equal to 0."; - } - - if ($this->container['leader'] === null) { - $invalidProperties[] = "'leader' can't be null"; - } - if ($this->container['status'] === null) { - $invalidProperties[] = "'status' can't be null"; - } - if ($this->container['term'] === null) { - $invalidProperties[] = "'term' can't be null"; - } - if (($this->container['term'] < 0)) { - $invalidProperties[] = "invalid value for 'term', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets address - * - * @return string - */ - public function getAddress() - { - return $this->container['address']; - } - - /** - * Sets address - * - * @param string $address address - * - * @return self - */ - public function setAddress($address) - { - if (is_null($address)) { - throw new \InvalidArgumentException('non-nullable address cannot be null'); - } - $this->container['address'] = $address; - - return $this; - } - - /** - * Gets commit - * - * @return int - */ - public function getCommit() - { - return $this->container['commit']; - } - - /** - * Sets commit - * - * @param int $commit commit - * - * @return self - */ - public function setCommit($commit) - { - if (is_null($commit)) { - throw new \InvalidArgumentException('non-nullable commit cannot be null'); - } - - if (($commit < 0)) { - throw new \InvalidArgumentException('invalid value for $commit when calling ClusterStatus., must be bigger than or equal to 0.'); - } - - $this->container['commit'] = $commit; - - return $this; - } - - /** - * Gets leader - * - * @return bool - */ - public function getLeader() - { - return $this->container['leader']; - } - - /** - * Sets leader - * - * @param bool $leader leader - * - * @return self - */ - public function setLeader($leader) - { - if (is_null($leader)) { - throw new \InvalidArgumentException('non-nullable leader cannot be null'); - } - $this->container['leader'] = $leader; - - return $this; - } - - /** - * Gets status - * - * @return bool - */ - public function getStatus() - { - return $this->container['status']; - } - - /** - * Sets status - * - * @param bool $status status - * - * @return self - */ - public function setStatus($status) - { - if (is_null($status)) { - throw new \InvalidArgumentException('non-nullable status cannot be null'); - } - $this->container['status'] = $status; - - return $this; - } - - /** - * Gets term - * - * @return int - */ - public function getTerm() - { - return $this->container['term']; - } - - /** - * Sets term - * - * @param int $term term - * - * @return self - */ - public function setTerm($term) - { - if (is_null($term)) { - throw new \InvalidArgumentException('non-nullable term cannot be null'); - } - - if (($term < 0)) { - throw new \InvalidArgumentException('invalid value for $term when calling ClusterStatus., must be bigger than or equal to 0.'); - } - - $this->container['term'] = $term; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/Comparison.php b/agdb_api/php/lib/Model/Comparison.php deleted file mode 100644 index 5fc46060..00000000 --- a/agdb_api/php/lib/Model/Comparison.php +++ /dev/null @@ -1,635 +0,0 @@ - - */ -class Comparison implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'equal' => '\Agnesoft\AgdbApi\Model\DbValue', - 'greater_than' => '\Agnesoft\AgdbApi\Model\DbValue', - 'greater_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue', - 'less_than' => '\Agnesoft\AgdbApi\Model\DbValue', - 'less_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue', - 'not_equal' => '\Agnesoft\AgdbApi\Model\DbValue', - 'contains' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'equal' => null, - 'greater_than' => null, - 'greater_than_or_equal' => null, - 'less_than' => null, - 'less_than_or_equal' => null, - 'not_equal' => null, - 'contains' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'equal' => false, - 'greater_than' => false, - 'greater_than_or_equal' => false, - 'less_than' => false, - 'less_than_or_equal' => false, - 'not_equal' => false, - 'contains' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'equal' => 'Equal', - 'greater_than' => 'GreaterThan', - 'greater_than_or_equal' => 'GreaterThanOrEqual', - 'less_than' => 'LessThan', - 'less_than_or_equal' => 'LessThanOrEqual', - 'not_equal' => 'NotEqual', - 'contains' => 'Contains' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'equal' => 'setEqual', - 'greater_than' => 'setGreaterThan', - 'greater_than_or_equal' => 'setGreaterThanOrEqual', - 'less_than' => 'setLessThan', - 'less_than_or_equal' => 'setLessThanOrEqual', - 'not_equal' => 'setNotEqual', - 'contains' => 'setContains' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'equal' => 'getEqual', - 'greater_than' => 'getGreaterThan', - 'greater_than_or_equal' => 'getGreaterThanOrEqual', - 'less_than' => 'getLessThan', - 'less_than_or_equal' => 'getLessThanOrEqual', - 'not_equal' => 'getNotEqual', - 'contains' => 'getContains' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('equal', $data ?? [], null); - $this->setIfExists('greater_than', $data ?? [], null); - $this->setIfExists('greater_than_or_equal', $data ?? [], null); - $this->setIfExists('less_than', $data ?? [], null); - $this->setIfExists('less_than_or_equal', $data ?? [], null); - $this->setIfExists('not_equal', $data ?? [], null); - $this->setIfExists('contains', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['equal'] === null) { - $invalidProperties[] = "'equal' can't be null"; - } - if ($this->container['greater_than'] === null) { - $invalidProperties[] = "'greater_than' can't be null"; - } - if ($this->container['greater_than_or_equal'] === null) { - $invalidProperties[] = "'greater_than_or_equal' can't be null"; - } - if ($this->container['less_than'] === null) { - $invalidProperties[] = "'less_than' can't be null"; - } - if ($this->container['less_than_or_equal'] === null) { - $invalidProperties[] = "'less_than_or_equal' can't be null"; - } - if ($this->container['not_equal'] === null) { - $invalidProperties[] = "'not_equal' can't be null"; - } - if ($this->container['contains'] === null) { - $invalidProperties[] = "'contains' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getEqual() - { - return $this->container['equal']; - } - - /** - * Sets equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $equal equal - * - * @return self - */ - public function setEqual($equal) - { - if (is_null($equal)) { - throw new \InvalidArgumentException('non-nullable equal cannot be null'); - } - $this->container['equal'] = $equal; - - return $this; - } - - /** - * Gets greater_than - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getGreaterThan() - { - return $this->container['greater_than']; - } - - /** - * Sets greater_than - * - * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than greater_than - * - * @return self - */ - public function setGreaterThan($greater_than) - { - if (is_null($greater_than)) { - throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); - } - $this->container['greater_than'] = $greater_than; - - return $this; - } - - /** - * Gets greater_than_or_equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getGreaterThanOrEqual() - { - return $this->container['greater_than_or_equal']; - } - - /** - * Sets greater_than_or_equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than_or_equal greater_than_or_equal - * - * @return self - */ - public function setGreaterThanOrEqual($greater_than_or_equal) - { - if (is_null($greater_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); - } - $this->container['greater_than_or_equal'] = $greater_than_or_equal; - - return $this; - } - - /** - * Gets less_than - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getLessThan() - { - return $this->container['less_than']; - } - - /** - * Sets less_than - * - * @param \Agnesoft\AgdbApi\Model\DbValue $less_than less_than - * - * @return self - */ - public function setLessThan($less_than) - { - if (is_null($less_than)) { - throw new \InvalidArgumentException('non-nullable less_than cannot be null'); - } - $this->container['less_than'] = $less_than; - - return $this; - } - - /** - * Gets less_than_or_equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getLessThanOrEqual() - { - return $this->container['less_than_or_equal']; - } - - /** - * Sets less_than_or_equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $less_than_or_equal less_than_or_equal - * - * @return self - */ - public function setLessThanOrEqual($less_than_or_equal) - { - if (is_null($less_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); - } - $this->container['less_than_or_equal'] = $less_than_or_equal; - - return $this; - } - - /** - * Gets not_equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getNotEqual() - { - return $this->container['not_equal']; - } - - /** - * Sets not_equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $not_equal not_equal - * - * @return self - */ - public function setNotEqual($not_equal) - { - if (is_null($not_equal)) { - throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); - } - $this->container['not_equal'] = $not_equal; - - return $this; - } - - /** - * Gets contains - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getContains() - { - return $this->container['contains']; - } - - /** - * Sets contains - * - * @param \Agnesoft\AgdbApi\Model\DbValue $contains contains - * - * @return self - */ - public function setContains($contains) - { - if (is_null($contains)) { - throw new \InvalidArgumentException('non-nullable contains cannot be null'); - } - $this->container['contains'] = $contains; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ComparisonOneOf.php b/agdb_api/php/lib/Model/ComparisonOneOf.php deleted file mode 100644 index cb62784b..00000000 --- a/agdb_api/php/lib/Model/ComparisonOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ComparisonOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'equal' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'equal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'equal' => 'Equal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'equal' => 'setEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'equal' => 'getEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['equal'] === null) { - $invalidProperties[] = "'equal' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getEqual() - { - return $this->container['equal']; - } - - /** - * Sets equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $equal equal - * - * @return self - */ - public function setEqual($equal) - { - if (is_null($equal)) { - throw new \InvalidArgumentException('non-nullable equal cannot be null'); - } - $this->container['equal'] = $equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ComparisonOneOf1.php b/agdb_api/php/lib/Model/ComparisonOneOf1.php deleted file mode 100644 index 7ca00987..00000000 --- a/agdb_api/php/lib/Model/ComparisonOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ComparisonOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'greater_than' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'greater_than' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'greater_than' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'greater_than' => 'GreaterThan' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'greater_than' => 'setGreaterThan' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'greater_than' => 'getGreaterThan' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('greater_than', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['greater_than'] === null) { - $invalidProperties[] = "'greater_than' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets greater_than - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getGreaterThan() - { - return $this->container['greater_than']; - } - - /** - * Sets greater_than - * - * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than greater_than - * - * @return self - */ - public function setGreaterThan($greater_than) - { - if (is_null($greater_than)) { - throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); - } - $this->container['greater_than'] = $greater_than; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ComparisonOneOf2.php b/agdb_api/php/lib/Model/ComparisonOneOf2.php deleted file mode 100644 index a5e7f2e1..00000000 --- a/agdb_api/php/lib/Model/ComparisonOneOf2.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ComparisonOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison_oneOf_2'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'greater_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'greater_than_or_equal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'greater_than_or_equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'greater_than_or_equal' => 'GreaterThanOrEqual' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'greater_than_or_equal' => 'setGreaterThanOrEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'greater_than_or_equal' => 'getGreaterThanOrEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('greater_than_or_equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['greater_than_or_equal'] === null) { - $invalidProperties[] = "'greater_than_or_equal' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets greater_than_or_equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getGreaterThanOrEqual() - { - return $this->container['greater_than_or_equal']; - } - - /** - * Sets greater_than_or_equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than_or_equal greater_than_or_equal - * - * @return self - */ - public function setGreaterThanOrEqual($greater_than_or_equal) - { - if (is_null($greater_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); - } - $this->container['greater_than_or_equal'] = $greater_than_or_equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ComparisonOneOf3.php b/agdb_api/php/lib/Model/ComparisonOneOf3.php deleted file mode 100644 index e36fc937..00000000 --- a/agdb_api/php/lib/Model/ComparisonOneOf3.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ComparisonOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison_oneOf_3'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'less_than' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'less_than' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'less_than' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'less_than' => 'LessThan' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'less_than' => 'setLessThan' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'less_than' => 'getLessThan' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('less_than', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['less_than'] === null) { - $invalidProperties[] = "'less_than' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets less_than - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getLessThan() - { - return $this->container['less_than']; - } - - /** - * Sets less_than - * - * @param \Agnesoft\AgdbApi\Model\DbValue $less_than less_than - * - * @return self - */ - public function setLessThan($less_than) - { - if (is_null($less_than)) { - throw new \InvalidArgumentException('non-nullable less_than cannot be null'); - } - $this->container['less_than'] = $less_than; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ComparisonOneOf4.php b/agdb_api/php/lib/Model/ComparisonOneOf4.php deleted file mode 100644 index 251934b2..00000000 --- a/agdb_api/php/lib/Model/ComparisonOneOf4.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ComparisonOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison_oneOf_4'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'less_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'less_than_or_equal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'less_than_or_equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'less_than_or_equal' => 'LessThanOrEqual' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'less_than_or_equal' => 'setLessThanOrEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'less_than_or_equal' => 'getLessThanOrEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('less_than_or_equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['less_than_or_equal'] === null) { - $invalidProperties[] = "'less_than_or_equal' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets less_than_or_equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getLessThanOrEqual() - { - return $this->container['less_than_or_equal']; - } - - /** - * Sets less_than_or_equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $less_than_or_equal less_than_or_equal - * - * @return self - */ - public function setLessThanOrEqual($less_than_or_equal) - { - if (is_null($less_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); - } - $this->container['less_than_or_equal'] = $less_than_or_equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ComparisonOneOf5.php b/agdb_api/php/lib/Model/ComparisonOneOf5.php deleted file mode 100644 index 730e6f1a..00000000 --- a/agdb_api/php/lib/Model/ComparisonOneOf5.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ComparisonOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison_oneOf_5'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'not_equal' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'not_equal' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'not_equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'not_equal' => 'NotEqual' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'not_equal' => 'setNotEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'not_equal' => 'getNotEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('not_equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['not_equal'] === null) { - $invalidProperties[] = "'not_equal' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets not_equal - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getNotEqual() - { - return $this->container['not_equal']; - } - - /** - * Sets not_equal - * - * @param \Agnesoft\AgdbApi\Model\DbValue $not_equal not_equal - * - * @return self - */ - public function setNotEqual($not_equal) - { - if (is_null($not_equal)) { - throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); - } - $this->container['not_equal'] = $not_equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ComparisonOneOf6.php b/agdb_api/php/lib/Model/ComparisonOneOf6.php deleted file mode 100644 index ff775747..00000000 --- a/agdb_api/php/lib/Model/ComparisonOneOf6.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ComparisonOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'Comparison_oneOf_6'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'contains' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'contains' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'contains' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'contains' => 'Contains' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'contains' => 'setContains' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'contains' => 'getContains' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('contains', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['contains'] === null) { - $invalidProperties[] = "'contains' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets contains - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getContains() - { - return $this->container['contains']; - } - - /** - * Sets contains - * - * @param \Agnesoft\AgdbApi\Model\DbValue $contains contains - * - * @return self - */ - public function setContains($contains) - { - if (is_null($contains)) { - throw new \InvalidArgumentException('non-nullable contains cannot be null'); - } - $this->container['contains'] = $contains; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/CountComparison.php b/agdb_api/php/lib/Model/CountComparison.php deleted file mode 100644 index f91ef4ad..00000000 --- a/agdb_api/php/lib/Model/CountComparison.php +++ /dev/null @@ -1,652 +0,0 @@ - - */ -class CountComparison implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CountComparison'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'equal' => 'int', - 'greater_than' => 'int', - 'greater_than_or_equal' => 'int', - 'less_than' => 'int', - 'less_than_or_equal' => 'int', - 'not_equal' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'equal' => 'int64', - 'greater_than' => 'int64', - 'greater_than_or_equal' => 'int64', - 'less_than' => 'int64', - 'less_than_or_equal' => 'int64', - 'not_equal' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'equal' => false, - 'greater_than' => false, - 'greater_than_or_equal' => false, - 'less_than' => false, - 'less_than_or_equal' => false, - 'not_equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'equal' => 'Equal', - 'greater_than' => 'GreaterThan', - 'greater_than_or_equal' => 'GreaterThanOrEqual', - 'less_than' => 'LessThan', - 'less_than_or_equal' => 'LessThanOrEqual', - 'not_equal' => 'NotEqual' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'equal' => 'setEqual', - 'greater_than' => 'setGreaterThan', - 'greater_than_or_equal' => 'setGreaterThanOrEqual', - 'less_than' => 'setLessThan', - 'less_than_or_equal' => 'setLessThanOrEqual', - 'not_equal' => 'setNotEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'equal' => 'getEqual', - 'greater_than' => 'getGreaterThan', - 'greater_than_or_equal' => 'getGreaterThanOrEqual', - 'less_than' => 'getLessThan', - 'less_than_or_equal' => 'getLessThanOrEqual', - 'not_equal' => 'getNotEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('equal', $data ?? [], null); - $this->setIfExists('greater_than', $data ?? [], null); - $this->setIfExists('greater_than_or_equal', $data ?? [], null); - $this->setIfExists('less_than', $data ?? [], null); - $this->setIfExists('less_than_or_equal', $data ?? [], null); - $this->setIfExists('not_equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['equal'] === null) { - $invalidProperties[] = "'equal' can't be null"; - } - if (($this->container['equal'] < 0)) { - $invalidProperties[] = "invalid value for 'equal', must be bigger than or equal to 0."; - } - - if ($this->container['greater_than'] === null) { - $invalidProperties[] = "'greater_than' can't be null"; - } - if (($this->container['greater_than'] < 0)) { - $invalidProperties[] = "invalid value for 'greater_than', must be bigger than or equal to 0."; - } - - if ($this->container['greater_than_or_equal'] === null) { - $invalidProperties[] = "'greater_than_or_equal' can't be null"; - } - if (($this->container['greater_than_or_equal'] < 0)) { - $invalidProperties[] = "invalid value for 'greater_than_or_equal', must be bigger than or equal to 0."; - } - - if ($this->container['less_than'] === null) { - $invalidProperties[] = "'less_than' can't be null"; - } - if (($this->container['less_than'] < 0)) { - $invalidProperties[] = "invalid value for 'less_than', must be bigger than or equal to 0."; - } - - if ($this->container['less_than_or_equal'] === null) { - $invalidProperties[] = "'less_than_or_equal' can't be null"; - } - if (($this->container['less_than_or_equal'] < 0)) { - $invalidProperties[] = "invalid value for 'less_than_or_equal', must be bigger than or equal to 0."; - } - - if ($this->container['not_equal'] === null) { - $invalidProperties[] = "'not_equal' can't be null"; - } - if (($this->container['not_equal'] < 0)) { - $invalidProperties[] = "invalid value for 'not_equal', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets equal - * - * @return int - */ - public function getEqual() - { - return $this->container['equal']; - } - - /** - * Sets equal - * - * @param int $equal property == this - * - * @return self - */ - public function setEqual($equal) - { - if (is_null($equal)) { - throw new \InvalidArgumentException('non-nullable equal cannot be null'); - } - - if (($equal < 0)) { - throw new \InvalidArgumentException('invalid value for $equal when calling CountComparison., must be bigger than or equal to 0.'); - } - - $this->container['equal'] = $equal; - - return $this; - } - - /** - * Gets greater_than - * - * @return int - */ - public function getGreaterThan() - { - return $this->container['greater_than']; - } - - /** - * Sets greater_than - * - * @param int $greater_than property > this - * - * @return self - */ - public function setGreaterThan($greater_than) - { - if (is_null($greater_than)) { - throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); - } - - if (($greater_than < 0)) { - throw new \InvalidArgumentException('invalid value for $greater_than when calling CountComparison., must be bigger than or equal to 0.'); - } - - $this->container['greater_than'] = $greater_than; - - return $this; - } - - /** - * Gets greater_than_or_equal - * - * @return int - */ - public function getGreaterThanOrEqual() - { - return $this->container['greater_than_or_equal']; - } - - /** - * Sets greater_than_or_equal - * - * @param int $greater_than_or_equal property >= this - * - * @return self - */ - public function setGreaterThanOrEqual($greater_than_or_equal) - { - if (is_null($greater_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); - } - - if (($greater_than_or_equal < 0)) { - throw new \InvalidArgumentException('invalid value for $greater_than_or_equal when calling CountComparison., must be bigger than or equal to 0.'); - } - - $this->container['greater_than_or_equal'] = $greater_than_or_equal; - - return $this; - } - - /** - * Gets less_than - * - * @return int - */ - public function getLessThan() - { - return $this->container['less_than']; - } - - /** - * Sets less_than - * - * @param int $less_than property < this - * - * @return self - */ - public function setLessThan($less_than) - { - if (is_null($less_than)) { - throw new \InvalidArgumentException('non-nullable less_than cannot be null'); - } - - if (($less_than < 0)) { - throw new \InvalidArgumentException('invalid value for $less_than when calling CountComparison., must be bigger than or equal to 0.'); - } - - $this->container['less_than'] = $less_than; - - return $this; - } - - /** - * Gets less_than_or_equal - * - * @return int - */ - public function getLessThanOrEqual() - { - return $this->container['less_than_or_equal']; - } - - /** - * Sets less_than_or_equal - * - * @param int $less_than_or_equal property <= this - * - * @return self - */ - public function setLessThanOrEqual($less_than_or_equal) - { - if (is_null($less_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); - } - - if (($less_than_or_equal < 0)) { - throw new \InvalidArgumentException('invalid value for $less_than_or_equal when calling CountComparison., must be bigger than or equal to 0.'); - } - - $this->container['less_than_or_equal'] = $less_than_or_equal; - - return $this; - } - - /** - * Gets not_equal - * - * @return int - */ - public function getNotEqual() - { - return $this->container['not_equal']; - } - - /** - * Sets not_equal - * - * @param int $not_equal property != this - * - * @return self - */ - public function setNotEqual($not_equal) - { - if (is_null($not_equal)) { - throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); - } - - if (($not_equal < 0)) { - throw new \InvalidArgumentException('invalid value for $not_equal when calling CountComparison., must be bigger than or equal to 0.'); - } - - $this->container['not_equal'] = $not_equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf.php b/agdb_api/php/lib/Model/CountComparisonOneOf.php deleted file mode 100644 index 86233fe8..00000000 --- a/agdb_api/php/lib/Model/CountComparisonOneOf.php +++ /dev/null @@ -1,421 +0,0 @@ - - */ -class CountComparisonOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CountComparison_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'equal' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'equal' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'equal' => 'Equal' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'equal' => 'setEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'equal' => 'getEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['equal'] === null) { - $invalidProperties[] = "'equal' can't be null"; - } - if (($this->container['equal'] < 0)) { - $invalidProperties[] = "invalid value for 'equal', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets equal - * - * @return int - */ - public function getEqual() - { - return $this->container['equal']; - } - - /** - * Sets equal - * - * @param int $equal property == this - * - * @return self - */ - public function setEqual($equal) - { - if (is_null($equal)) { - throw new \InvalidArgumentException('non-nullable equal cannot be null'); - } - - if (($equal < 0)) { - throw new \InvalidArgumentException('invalid value for $equal when calling CountComparisonOneOf., must be bigger than or equal to 0.'); - } - - $this->container['equal'] = $equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf1.php b/agdb_api/php/lib/Model/CountComparisonOneOf1.php deleted file mode 100644 index ddb69461..00000000 --- a/agdb_api/php/lib/Model/CountComparisonOneOf1.php +++ /dev/null @@ -1,421 +0,0 @@ - - */ -class CountComparisonOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CountComparison_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'greater_than' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'greater_than' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'greater_than' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'greater_than' => 'GreaterThan' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'greater_than' => 'setGreaterThan' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'greater_than' => 'getGreaterThan' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('greater_than', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['greater_than'] === null) { - $invalidProperties[] = "'greater_than' can't be null"; - } - if (($this->container['greater_than'] < 0)) { - $invalidProperties[] = "invalid value for 'greater_than', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets greater_than - * - * @return int - */ - public function getGreaterThan() - { - return $this->container['greater_than']; - } - - /** - * Sets greater_than - * - * @param int $greater_than property > this - * - * @return self - */ - public function setGreaterThan($greater_than) - { - if (is_null($greater_than)) { - throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); - } - - if (($greater_than < 0)) { - throw new \InvalidArgumentException('invalid value for $greater_than when calling CountComparisonOneOf1., must be bigger than or equal to 0.'); - } - - $this->container['greater_than'] = $greater_than; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf2.php b/agdb_api/php/lib/Model/CountComparisonOneOf2.php deleted file mode 100644 index f7234d2d..00000000 --- a/agdb_api/php/lib/Model/CountComparisonOneOf2.php +++ /dev/null @@ -1,421 +0,0 @@ - - */ -class CountComparisonOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CountComparison_oneOf_2'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'greater_than_or_equal' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'greater_than_or_equal' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'greater_than_or_equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'greater_than_or_equal' => 'GreaterThanOrEqual' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'greater_than_or_equal' => 'setGreaterThanOrEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'greater_than_or_equal' => 'getGreaterThanOrEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('greater_than_or_equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['greater_than_or_equal'] === null) { - $invalidProperties[] = "'greater_than_or_equal' can't be null"; - } - if (($this->container['greater_than_or_equal'] < 0)) { - $invalidProperties[] = "invalid value for 'greater_than_or_equal', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets greater_than_or_equal - * - * @return int - */ - public function getGreaterThanOrEqual() - { - return $this->container['greater_than_or_equal']; - } - - /** - * Sets greater_than_or_equal - * - * @param int $greater_than_or_equal property >= this - * - * @return self - */ - public function setGreaterThanOrEqual($greater_than_or_equal) - { - if (is_null($greater_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); - } - - if (($greater_than_or_equal < 0)) { - throw new \InvalidArgumentException('invalid value for $greater_than_or_equal when calling CountComparisonOneOf2., must be bigger than or equal to 0.'); - } - - $this->container['greater_than_or_equal'] = $greater_than_or_equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf3.php b/agdb_api/php/lib/Model/CountComparisonOneOf3.php deleted file mode 100644 index df8350f8..00000000 --- a/agdb_api/php/lib/Model/CountComparisonOneOf3.php +++ /dev/null @@ -1,421 +0,0 @@ - - */ -class CountComparisonOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CountComparison_oneOf_3'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'less_than' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'less_than' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'less_than' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'less_than' => 'LessThan' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'less_than' => 'setLessThan' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'less_than' => 'getLessThan' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('less_than', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['less_than'] === null) { - $invalidProperties[] = "'less_than' can't be null"; - } - if (($this->container['less_than'] < 0)) { - $invalidProperties[] = "invalid value for 'less_than', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets less_than - * - * @return int - */ - public function getLessThan() - { - return $this->container['less_than']; - } - - /** - * Sets less_than - * - * @param int $less_than property < this - * - * @return self - */ - public function setLessThan($less_than) - { - if (is_null($less_than)) { - throw new \InvalidArgumentException('non-nullable less_than cannot be null'); - } - - if (($less_than < 0)) { - throw new \InvalidArgumentException('invalid value for $less_than when calling CountComparisonOneOf3., must be bigger than or equal to 0.'); - } - - $this->container['less_than'] = $less_than; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf4.php b/agdb_api/php/lib/Model/CountComparisonOneOf4.php deleted file mode 100644 index 3a171f1a..00000000 --- a/agdb_api/php/lib/Model/CountComparisonOneOf4.php +++ /dev/null @@ -1,421 +0,0 @@ - - */ -class CountComparisonOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CountComparison_oneOf_4'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'less_than_or_equal' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'less_than_or_equal' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'less_than_or_equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'less_than_or_equal' => 'LessThanOrEqual' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'less_than_or_equal' => 'setLessThanOrEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'less_than_or_equal' => 'getLessThanOrEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('less_than_or_equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['less_than_or_equal'] === null) { - $invalidProperties[] = "'less_than_or_equal' can't be null"; - } - if (($this->container['less_than_or_equal'] < 0)) { - $invalidProperties[] = "invalid value for 'less_than_or_equal', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets less_than_or_equal - * - * @return int - */ - public function getLessThanOrEqual() - { - return $this->container['less_than_or_equal']; - } - - /** - * Sets less_than_or_equal - * - * @param int $less_than_or_equal property <= this - * - * @return self - */ - public function setLessThanOrEqual($less_than_or_equal) - { - if (is_null($less_than_or_equal)) { - throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); - } - - if (($less_than_or_equal < 0)) { - throw new \InvalidArgumentException('invalid value for $less_than_or_equal when calling CountComparisonOneOf4., must be bigger than or equal to 0.'); - } - - $this->container['less_than_or_equal'] = $less_than_or_equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf5.php b/agdb_api/php/lib/Model/CountComparisonOneOf5.php deleted file mode 100644 index 4d8a1012..00000000 --- a/agdb_api/php/lib/Model/CountComparisonOneOf5.php +++ /dev/null @@ -1,421 +0,0 @@ - - */ -class CountComparisonOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'CountComparison_oneOf_5'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'not_equal' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'not_equal' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'not_equal' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'not_equal' => 'NotEqual' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'not_equal' => 'setNotEqual' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'not_equal' => 'getNotEqual' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('not_equal', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['not_equal'] === null) { - $invalidProperties[] = "'not_equal' can't be null"; - } - if (($this->container['not_equal'] < 0)) { - $invalidProperties[] = "invalid value for 'not_equal', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets not_equal - * - * @return int - */ - public function getNotEqual() - { - return $this->container['not_equal']; - } - - /** - * Sets not_equal - * - * @param int $not_equal property != this - * - * @return self - */ - public function setNotEqual($not_equal) - { - if (is_null($not_equal)) { - throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); - } - - if (($not_equal < 0)) { - throw new \InvalidArgumentException('invalid value for $not_equal when calling CountComparisonOneOf5., must be bigger than or equal to 0.'); - } - - $this->container['not_equal'] = $not_equal; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbElement.php b/agdb_api/php/lib/Model/DbElement.php deleted file mode 100644 index 40285074..00000000 --- a/agdb_api/php/lib/Model/DbElement.php +++ /dev/null @@ -1,532 +0,0 @@ - - */ -class DbElement implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbElement'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'from' => 'int', - 'id' => 'int', - 'to' => 'int', - 'values' => '\Agnesoft\AgdbApi\Model\DbKeyValue[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'from' => 'int64', - 'id' => 'int64', - 'to' => 'int64', - 'values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'from' => true, - 'id' => false, - 'to' => true, - 'values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'from' => 'from', - 'id' => 'id', - 'to' => 'to', - 'values' => 'values' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'from' => 'setFrom', - 'id' => 'setId', - 'to' => 'setTo', - 'values' => 'setValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'from' => 'getFrom', - 'id' => 'getId', - 'to' => 'getTo', - 'values' => 'getValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('from', $data ?? [], null); - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - if ($this->container['values'] === null) { - $invalidProperties[] = "'values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets from - * - * @return int|null - */ - public function getFrom() - { - return $this->container['from']; - } - - /** - * Sets from - * - * @param int|null $from Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. - * - * @return self - */ - public function setFrom($from) - { - if (is_null($from)) { - array_push($this->openAPINullablesSetToNull, 'from'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('from', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['from'] = $from; - - return $this; - } - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets to - * - * @return int|null - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param int|null $to Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. - * - * @return self - */ - public function setTo($to) - { - if (is_null($to)) { - array_push($this->openAPINullablesSetToNull, 'to'); - } else { - $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); - $index = array_search('to', $nullablesSetToNull); - if ($index !== FALSE) { - unset($nullablesSetToNull[$index]); - $this->setOpenAPINullablesSetToNull($nullablesSetToNull); - } - } - $this->container['to'] = $to; - - return $this; - } - - /** - * Gets values - * - * @return \Agnesoft\AgdbApi\Model\DbKeyValue[] - */ - public function getValues() - { - return $this->container['values']; - } - - /** - * Sets values - * - * @param \Agnesoft\AgdbApi\Model\DbKeyValue[] $values List of key-value pairs associated with the element. - * - * @return self - */ - public function setValues($values) - { - if (is_null($values)) { - throw new \InvalidArgumentException('non-nullable values cannot be null'); - } - $this->container['values'] = $values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbKeyOrder.php b/agdb_api/php/lib/Model/DbKeyOrder.php deleted file mode 100644 index 2550e18f..00000000 --- a/agdb_api/php/lib/Model/DbKeyOrder.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class DbKeyOrder implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbKeyOrder'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'asc' => '\Agnesoft\AgdbApi\Model\DbValue', - 'desc' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'asc' => null, - 'desc' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'asc' => false, - 'desc' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'asc' => 'Asc', - 'desc' => 'Desc' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'asc' => 'setAsc', - 'desc' => 'setDesc' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'asc' => 'getAsc', - 'desc' => 'getDesc' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('asc', $data ?? [], null); - $this->setIfExists('desc', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['asc'] === null) { - $invalidProperties[] = "'asc' can't be null"; - } - if ($this->container['desc'] === null) { - $invalidProperties[] = "'desc' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets asc - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getAsc() - { - return $this->container['asc']; - } - - /** - * Sets asc - * - * @param \Agnesoft\AgdbApi\Model\DbValue $asc asc - * - * @return self - */ - public function setAsc($asc) - { - if (is_null($asc)) { - throw new \InvalidArgumentException('non-nullable asc cannot be null'); - } - $this->container['asc'] = $asc; - - return $this; - } - - /** - * Gets desc - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getDesc() - { - return $this->container['desc']; - } - - /** - * Sets desc - * - * @param \Agnesoft\AgdbApi\Model\DbValue $desc desc - * - * @return self - */ - public function setDesc($desc) - { - if (is_null($desc)) { - throw new \InvalidArgumentException('non-nullable desc cannot be null'); - } - $this->container['desc'] = $desc; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbKeyOrderOneOf.php b/agdb_api/php/lib/Model/DbKeyOrderOneOf.php deleted file mode 100644 index 7ba7ccb9..00000000 --- a/agdb_api/php/lib/Model/DbKeyOrderOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbKeyOrderOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbKeyOrder_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'asc' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'asc' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'asc' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'asc' => 'Asc' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'asc' => 'setAsc' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'asc' => 'getAsc' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('asc', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['asc'] === null) { - $invalidProperties[] = "'asc' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets asc - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getAsc() - { - return $this->container['asc']; - } - - /** - * Sets asc - * - * @param \Agnesoft\AgdbApi\Model\DbValue $asc asc - * - * @return self - */ - public function setAsc($asc) - { - if (is_null($asc)) { - throw new \InvalidArgumentException('non-nullable asc cannot be null'); - } - $this->container['asc'] = $asc; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbKeyOrderOneOf1.php b/agdb_api/php/lib/Model/DbKeyOrderOneOf1.php deleted file mode 100644 index eba730b3..00000000 --- a/agdb_api/php/lib/Model/DbKeyOrderOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbKeyOrderOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbKeyOrder_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'desc' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'desc' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'desc' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'desc' => 'Desc' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'desc' => 'setDesc' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'desc' => 'getDesc' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('desc', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['desc'] === null) { - $invalidProperties[] = "'desc' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets desc - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getDesc() - { - return $this->container['desc']; - } - - /** - * Sets desc - * - * @param \Agnesoft\AgdbApi\Model\DbValue $desc desc - * - * @return self - */ - public function setDesc($desc) - { - if (is_null($desc)) { - throw new \InvalidArgumentException('non-nullable desc cannot be null'); - } - $this->container['desc'] = $desc; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbKeyValue.php b/agdb_api/php/lib/Model/DbKeyValue.php deleted file mode 100644 index 9dafa022..00000000 --- a/agdb_api/php/lib/Model/DbKeyValue.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class DbKeyValue implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbKeyValue'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'key' => '\Agnesoft\AgdbApi\Model\DbValue', - 'value' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'key' => null, - 'value' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'key' => false, - 'value' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'key' => 'key', - 'value' => 'value' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'key' => 'setKey', - 'value' => 'setValue' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'key' => 'getKey', - 'value' => 'getValue' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('key', $data ?? [], null); - $this->setIfExists('value', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['key'] === null) { - $invalidProperties[] = "'key' can't be null"; - } - if ($this->container['value'] === null) { - $invalidProperties[] = "'value' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets key - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param \Agnesoft\AgdbApi\Model\DbValue $key key - * - * @return self - */ - public function setKey($key) - { - if (is_null($key)) { - throw new \InvalidArgumentException('non-nullable key cannot be null'); - } - $this->container['key'] = $key; - - return $this; - } - - /** - * Gets value - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getValue() - { - return $this->container['value']; - } - - /** - * Sets value - * - * @param \Agnesoft\AgdbApi\Model\DbValue $value value - * - * @return self - */ - public function setValue($value) - { - if (is_null($value)) { - throw new \InvalidArgumentException('non-nullable value cannot be null'); - } - $this->container['value'] = $value; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbResource.php b/agdb_api/php/lib/Model/DbResource.php deleted file mode 100644 index 56bf8ed5..00000000 --- a/agdb_api/php/lib/Model/DbResource.php +++ /dev/null @@ -1,68 +0,0 @@ - - */ -class DbTypeParam implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbTypeParam'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'db_type' => '\Agnesoft\AgdbApi\Model\DbType' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'db_type' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'db_type' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'db_type' => 'db_type' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'db_type' => 'setDbType' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'db_type' => 'getDbType' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('db_type', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['db_type'] === null) { - $invalidProperties[] = "'db_type' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets db_type - * - * @return \Agnesoft\AgdbApi\Model\DbType - */ - public function getDbType() - { - return $this->container['db_type']; - } - - /** - * Sets db_type - * - * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type - * - * @return self - */ - public function setDbType($db_type) - { - if (is_null($db_type)) { - throw new \InvalidArgumentException('non-nullable db_type cannot be null'); - } - $this->container['db_type'] = $db_type; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbUser.php b/agdb_api/php/lib/Model/DbUser.php deleted file mode 100644 index 18725d76..00000000 --- a/agdb_api/php/lib/Model/DbUser.php +++ /dev/null @@ -1,449 +0,0 @@ - - */ -class DbUser implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbUser'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'role' => '\Agnesoft\AgdbApi\Model\DbUserRole', - 'user' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'role' => null, - 'user' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'role' => false, - 'user' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'role' => 'role', - 'user' => 'user' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'role' => 'setRole', - 'user' => 'setUser' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'role' => 'getRole', - 'user' => 'getUser' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('role', $data ?? [], null); - $this->setIfExists('user', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['role'] === null) { - $invalidProperties[] = "'role' can't be null"; - } - if ($this->container['user'] === null) { - $invalidProperties[] = "'user' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets role - * - * @return \Agnesoft\AgdbApi\Model\DbUserRole - */ - public function getRole() - { - return $this->container['role']; - } - - /** - * Sets role - * - * @param \Agnesoft\AgdbApi\Model\DbUserRole $role role - * - * @return self - */ - public function setRole($role) - { - if (is_null($role)) { - throw new \InvalidArgumentException('non-nullable role cannot be null'); - } - $this->container['role'] = $role; - - return $this; - } - - /** - * Gets user - * - * @return string - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param string $user user - * - * @return self - */ - public function setUser($user) - { - if (is_null($user)) { - throw new \InvalidArgumentException('non-nullable user cannot be null'); - } - $this->container['user'] = $user; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbUserRole.php b/agdb_api/php/lib/Model/DbUserRole.php deleted file mode 100644 index 065f9777..00000000 --- a/agdb_api/php/lib/Model/DbUserRole.php +++ /dev/null @@ -1,65 +0,0 @@ - - */ -class DbUserRoleParam implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbUserRoleParam'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'db_role' => '\Agnesoft\AgdbApi\Model\DbUserRole' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'db_role' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'db_role' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'db_role' => 'db_role' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'db_role' => 'setDbRole' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'db_role' => 'getDbRole' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('db_role', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['db_role'] === null) { - $invalidProperties[] = "'db_role' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets db_role - * - * @return \Agnesoft\AgdbApi\Model\DbUserRole - */ - public function getDbRole() - { - return $this->container['db_role']; - } - - /** - * Sets db_role - * - * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role db_role - * - * @return self - */ - public function setDbRole($db_role) - { - if (is_null($db_role)) { - throw new \InvalidArgumentException('non-nullable db_role cannot be null'); - } - $this->container['db_role'] = $db_role; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValue.php b/agdb_api/php/lib/Model/DbValue.php deleted file mode 100644 index 672d07a2..00000000 --- a/agdb_api/php/lib/Model/DbValue.php +++ /dev/null @@ -1,718 +0,0 @@ - - */ -class DbValue implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'bytes' => '\SplFileObject', - 'i64' => 'int', - 'u64' => 'int', - 'f64' => 'float', - 'string' => 'string', - 'vec_i64' => 'int[]', - 'vec_u64' => 'int[]', - 'vec_f64' => 'float[]', - 'vec_string' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'bytes' => 'binary', - 'i64' => 'int64', - 'u64' => 'int64', - 'f64' => 'double', - 'string' => null, - 'vec_i64' => 'int64', - 'vec_u64' => 'int64', - 'vec_f64' => 'double', - 'vec_string' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'bytes' => false, - 'i64' => false, - 'u64' => false, - 'f64' => false, - 'string' => false, - 'vec_i64' => false, - 'vec_u64' => false, - 'vec_f64' => false, - 'vec_string' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'bytes' => 'Bytes', - 'i64' => 'I64', - 'u64' => 'U64', - 'f64' => 'F64', - 'string' => 'String', - 'vec_i64' => 'VecI64', - 'vec_u64' => 'VecU64', - 'vec_f64' => 'VecF64', - 'vec_string' => 'VecString' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'bytes' => 'setBytes', - 'i64' => 'setI64', - 'u64' => 'setU64', - 'f64' => 'setF64', - 'string' => 'setString', - 'vec_i64' => 'setVecI64', - 'vec_u64' => 'setVecU64', - 'vec_f64' => 'setVecF64', - 'vec_string' => 'setVecString' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'bytes' => 'getBytes', - 'i64' => 'getI64', - 'u64' => 'getU64', - 'f64' => 'getF64', - 'string' => 'getString', - 'vec_i64' => 'getVecI64', - 'vec_u64' => 'getVecU64', - 'vec_f64' => 'getVecF64', - 'vec_string' => 'getVecString' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('bytes', $data ?? [], null); - $this->setIfExists('i64', $data ?? [], null); - $this->setIfExists('u64', $data ?? [], null); - $this->setIfExists('f64', $data ?? [], null); - $this->setIfExists('string', $data ?? [], null); - $this->setIfExists('vec_i64', $data ?? [], null); - $this->setIfExists('vec_u64', $data ?? [], null); - $this->setIfExists('vec_f64', $data ?? [], null); - $this->setIfExists('vec_string', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['bytes'] === null) { - $invalidProperties[] = "'bytes' can't be null"; - } - if ($this->container['i64'] === null) { - $invalidProperties[] = "'i64' can't be null"; - } - if ($this->container['u64'] === null) { - $invalidProperties[] = "'u64' can't be null"; - } - if (($this->container['u64'] < 0)) { - $invalidProperties[] = "invalid value for 'u64', must be bigger than or equal to 0."; - } - - if ($this->container['f64'] === null) { - $invalidProperties[] = "'f64' can't be null"; - } - if ($this->container['string'] === null) { - $invalidProperties[] = "'string' can't be null"; - } - if ($this->container['vec_i64'] === null) { - $invalidProperties[] = "'vec_i64' can't be null"; - } - if ($this->container['vec_u64'] === null) { - $invalidProperties[] = "'vec_u64' can't be null"; - } - if ($this->container['vec_f64'] === null) { - $invalidProperties[] = "'vec_f64' can't be null"; - } - if ($this->container['vec_string'] === null) { - $invalidProperties[] = "'vec_string' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets bytes - * - * @return \SplFileObject - */ - public function getBytes() - { - return $this->container['bytes']; - } - - /** - * Sets bytes - * - * @param \SplFileObject $bytes Byte array, sometimes referred to as blob - * - * @return self - */ - public function setBytes($bytes) - { - if (is_null($bytes)) { - throw new \InvalidArgumentException('non-nullable bytes cannot be null'); - } - $this->container['bytes'] = $bytes; - - return $this; - } - - /** - * Gets i64 - * - * @return int - */ - public function getI64() - { - return $this->container['i64']; - } - - /** - * Sets i64 - * - * @param int $i64 64-bit wide signed integer - * - * @return self - */ - public function setI64($i64) - { - if (is_null($i64)) { - throw new \InvalidArgumentException('non-nullable i64 cannot be null'); - } - $this->container['i64'] = $i64; - - return $this; - } - - /** - * Gets u64 - * - * @return int - */ - public function getU64() - { - return $this->container['u64']; - } - - /** - * Sets u64 - * - * @param int $u64 64-bit wide unsigned integer - * - * @return self - */ - public function setU64($u64) - { - if (is_null($u64)) { - throw new \InvalidArgumentException('non-nullable u64 cannot be null'); - } - - if (($u64 < 0)) { - throw new \InvalidArgumentException('invalid value for $u64 when calling DbValue., must be bigger than or equal to 0.'); - } - - $this->container['u64'] = $u64; - - return $this; - } - - /** - * Gets f64 - * - * @return float - */ - public function getF64() - { - return $this->container['f64']; - } - - /** - * Sets f64 - * - * @param float $f64 Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. - * - * @return self - */ - public function setF64($f64) - { - if (is_null($f64)) { - throw new \InvalidArgumentException('non-nullable f64 cannot be null'); - } - $this->container['f64'] = $f64; - - return $this; - } - - /** - * Gets string - * - * @return string - */ - public function getString() - { - return $this->container['string']; - } - - /** - * Sets string - * - * @param string $string UTF-8 string - * - * @return self - */ - public function setString($string) - { - if (is_null($string)) { - throw new \InvalidArgumentException('non-nullable string cannot be null'); - } - $this->container['string'] = $string; - - return $this; - } - - /** - * Gets vec_i64 - * - * @return int[] - */ - public function getVecI64() - { - return $this->container['vec_i64']; - } - - /** - * Sets vec_i64 - * - * @param int[] $vec_i64 List of 64-bit wide signed integers - * - * @return self - */ - public function setVecI64($vec_i64) - { - if (is_null($vec_i64)) { - throw new \InvalidArgumentException('non-nullable vec_i64 cannot be null'); - } - $this->container['vec_i64'] = $vec_i64; - - return $this; - } - - /** - * Gets vec_u64 - * - * @return int[] - */ - public function getVecU64() - { - return $this->container['vec_u64']; - } - - /** - * Sets vec_u64 - * - * @param int[] $vec_u64 List of 64-bit wide unsigned integers - * - * @return self - */ - public function setVecU64($vec_u64) - { - if (is_null($vec_u64)) { - throw new \InvalidArgumentException('non-nullable vec_u64 cannot be null'); - } - $this->container['vec_u64'] = $vec_u64; - - return $this; - } - - /** - * Gets vec_f64 - * - * @return float[] - */ - public function getVecF64() - { - return $this->container['vec_f64']; - } - - /** - * Sets vec_f64 - * - * @param float[] $vec_f64 List of 64-bit floating point numbers - * - * @return self - */ - public function setVecF64($vec_f64) - { - if (is_null($vec_f64)) { - throw new \InvalidArgumentException('non-nullable vec_f64 cannot be null'); - } - $this->container['vec_f64'] = $vec_f64; - - return $this; - } - - /** - * Gets vec_string - * - * @return string[] - */ - public function getVecString() - { - return $this->container['vec_string']; - } - - /** - * Sets vec_string - * - * @param string[] $vec_string List of UTF-8 strings - * - * @return self - */ - public function setVecString($vec_string) - { - if (is_null($vec_string)) { - throw new \InvalidArgumentException('non-nullable vec_string cannot be null'); - } - $this->container['vec_string'] = $vec_string; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf.php b/agdb_api/php/lib/Model/DbValueOneOf.php deleted file mode 100644 index e7fa53ba..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'bytes' => '\SplFileObject' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'bytes' => 'binary' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'bytes' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'bytes' => 'Bytes' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'bytes' => 'setBytes' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'bytes' => 'getBytes' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('bytes', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['bytes'] === null) { - $invalidProperties[] = "'bytes' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets bytes - * - * @return \SplFileObject - */ - public function getBytes() - { - return $this->container['bytes']; - } - - /** - * Sets bytes - * - * @param \SplFileObject $bytes Byte array, sometimes referred to as blob - * - * @return self - */ - public function setBytes($bytes) - { - if (is_null($bytes)) { - throw new \InvalidArgumentException('non-nullable bytes cannot be null'); - } - $this->container['bytes'] = $bytes; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf1.php b/agdb_api/php/lib/Model/DbValueOneOf1.php deleted file mode 100644 index 654bcd3b..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'i64' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'i64' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'i64' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'i64' => 'I64' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'i64' => 'setI64' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'i64' => 'getI64' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('i64', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['i64'] === null) { - $invalidProperties[] = "'i64' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets i64 - * - * @return int - */ - public function getI64() - { - return $this->container['i64']; - } - - /** - * Sets i64 - * - * @param int $i64 64-bit wide signed integer - * - * @return self - */ - public function setI64($i64) - { - if (is_null($i64)) { - throw new \InvalidArgumentException('non-nullable i64 cannot be null'); - } - $this->container['i64'] = $i64; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf2.php b/agdb_api/php/lib/Model/DbValueOneOf2.php deleted file mode 100644 index 216325c2..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf2.php +++ /dev/null @@ -1,421 +0,0 @@ - - */ -class DbValueOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_2'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'u64' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'u64' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'u64' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'u64' => 'U64' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'u64' => 'setU64' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'u64' => 'getU64' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('u64', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['u64'] === null) { - $invalidProperties[] = "'u64' can't be null"; - } - if (($this->container['u64'] < 0)) { - $invalidProperties[] = "invalid value for 'u64', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets u64 - * - * @return int - */ - public function getU64() - { - return $this->container['u64']; - } - - /** - * Sets u64 - * - * @param int $u64 64-bit wide unsigned integer - * - * @return self - */ - public function setU64($u64) - { - if (is_null($u64)) { - throw new \InvalidArgumentException('non-nullable u64 cannot be null'); - } - - if (($u64 < 0)) { - throw new \InvalidArgumentException('invalid value for $u64 when calling DbValueOneOf2., must be bigger than or equal to 0.'); - } - - $this->container['u64'] = $u64; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf3.php b/agdb_api/php/lib/Model/DbValueOneOf3.php deleted file mode 100644 index e954fef3..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf3.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_3'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'f64' => 'float' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'f64' => 'double' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'f64' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'f64' => 'F64' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'f64' => 'setF64' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'f64' => 'getF64' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('f64', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['f64'] === null) { - $invalidProperties[] = "'f64' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets f64 - * - * @return float - */ - public function getF64() - { - return $this->container['f64']; - } - - /** - * Sets f64 - * - * @param float $f64 Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. - * - * @return self - */ - public function setF64($f64) - { - if (is_null($f64)) { - throw new \InvalidArgumentException('non-nullable f64 cannot be null'); - } - $this->container['f64'] = $f64; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf4.php b/agdb_api/php/lib/Model/DbValueOneOf4.php deleted file mode 100644 index d70e0514..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf4.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_4'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'string' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'string' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'string' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'string' => 'String' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'string' => 'setString' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'string' => 'getString' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('string', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['string'] === null) { - $invalidProperties[] = "'string' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets string - * - * @return string - */ - public function getString() - { - return $this->container['string']; - } - - /** - * Sets string - * - * @param string $string UTF-8 string - * - * @return self - */ - public function setString($string) - { - if (is_null($string)) { - throw new \InvalidArgumentException('non-nullable string cannot be null'); - } - $this->container['string'] = $string; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf5.php b/agdb_api/php/lib/Model/DbValueOneOf5.php deleted file mode 100644 index dd25a712..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf5.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_5'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'vec_i64' => 'int[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'vec_i64' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'vec_i64' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'vec_i64' => 'VecI64' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'vec_i64' => 'setVecI64' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'vec_i64' => 'getVecI64' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('vec_i64', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['vec_i64'] === null) { - $invalidProperties[] = "'vec_i64' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets vec_i64 - * - * @return int[] - */ - public function getVecI64() - { - return $this->container['vec_i64']; - } - - /** - * Sets vec_i64 - * - * @param int[] $vec_i64 List of 64-bit wide signed integers - * - * @return self - */ - public function setVecI64($vec_i64) - { - if (is_null($vec_i64)) { - throw new \InvalidArgumentException('non-nullable vec_i64 cannot be null'); - } - $this->container['vec_i64'] = $vec_i64; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf6.php b/agdb_api/php/lib/Model/DbValueOneOf6.php deleted file mode 100644 index b3769299..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf6.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_6'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'vec_u64' => 'int[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'vec_u64' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'vec_u64' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'vec_u64' => 'VecU64' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'vec_u64' => 'setVecU64' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'vec_u64' => 'getVecU64' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('vec_u64', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['vec_u64'] === null) { - $invalidProperties[] = "'vec_u64' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets vec_u64 - * - * @return int[] - */ - public function getVecU64() - { - return $this->container['vec_u64']; - } - - /** - * Sets vec_u64 - * - * @param int[] $vec_u64 List of 64-bit wide unsigned integers - * - * @return self - */ - public function setVecU64($vec_u64) - { - if (is_null($vec_u64)) { - throw new \InvalidArgumentException('non-nullable vec_u64 cannot be null'); - } - $this->container['vec_u64'] = $vec_u64; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf7.php b/agdb_api/php/lib/Model/DbValueOneOf7.php deleted file mode 100644 index 8d153749..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf7.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf7 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_7'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'vec_f64' => 'float[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'vec_f64' => 'double' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'vec_f64' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'vec_f64' => 'VecF64' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'vec_f64' => 'setVecF64' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'vec_f64' => 'getVecF64' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('vec_f64', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['vec_f64'] === null) { - $invalidProperties[] = "'vec_f64' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets vec_f64 - * - * @return float[] - */ - public function getVecF64() - { - return $this->container['vec_f64']; - } - - /** - * Sets vec_f64 - * - * @param float[] $vec_f64 List of 64-bit floating point numbers - * - * @return self - */ - public function setVecF64($vec_f64) - { - if (is_null($vec_f64)) { - throw new \InvalidArgumentException('non-nullable vec_f64 cannot be null'); - } - $this->container['vec_f64'] = $vec_f64; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/DbValueOneOf8.php b/agdb_api/php/lib/Model/DbValueOneOf8.php deleted file mode 100644 index 95b97e3f..00000000 --- a/agdb_api/php/lib/Model/DbValueOneOf8.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class DbValueOneOf8 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'DbValue_oneOf_8'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'vec_string' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'vec_string' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'vec_string' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'vec_string' => 'VecString' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'vec_string' => 'setVecString' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'vec_string' => 'getVecString' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('vec_string', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['vec_string'] === null) { - $invalidProperties[] = "'vec_string' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets vec_string - * - * @return string[] - */ - public function getVecString() - { - return $this->container['vec_string']; - } - - /** - * Sets vec_string - * - * @param string[] $vec_string List of UTF-8 strings - * - * @return self - */ - public function setVecString($vec_string) - { - if (is_null($vec_string)) { - throw new \InvalidArgumentException('non-nullable vec_string cannot be null'); - } - $this->container['vec_string'] = $vec_string; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/InsertAliasesQuery.php b/agdb_api/php/lib/Model/InsertAliasesQuery.php deleted file mode 100644 index 9706e946..00000000 --- a/agdb_api/php/lib/Model/InsertAliasesQuery.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class InsertAliasesQuery implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'InsertAliasesQuery'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'aliases' => 'string[]', - 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'aliases' => null, - 'ids' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'aliases' => false, - 'ids' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'aliases' => 'aliases', - 'ids' => 'ids' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'aliases' => 'setAliases', - 'ids' => 'setIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'aliases' => 'getAliases', - 'ids' => 'getIds' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('aliases', $data ?? [], null); - $this->setIfExists('ids', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['aliases'] === null) { - $invalidProperties[] = "'aliases' can't be null"; - } - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets aliases - * - * @return string[] - */ - public function getAliases() - { - return $this->container['aliases']; - } - - /** - * Sets aliases - * - * @param string[] $aliases Aliases to be inserted - * - * @return self - */ - public function setAliases($aliases) - { - if (is_null($aliases)) { - throw new \InvalidArgumentException('non-nullable aliases cannot be null'); - } - $this->container['aliases'] = $aliases; - - return $this; - } - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/InsertEdgesQuery.php b/agdb_api/php/lib/Model/InsertEdgesQuery.php deleted file mode 100644 index 22b9cd74..00000000 --- a/agdb_api/php/lib/Model/InsertEdgesQuery.php +++ /dev/null @@ -1,561 +0,0 @@ - - */ -class InsertEdgesQuery implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'InsertEdgesQuery'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'each' => 'bool', - 'from' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'to' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'values' => '\Agnesoft\AgdbApi\Model\QueryValues' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'each' => null, - 'from' => null, - 'ids' => null, - 'to' => null, - 'values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'each' => false, - 'from' => false, - 'ids' => false, - 'to' => false, - 'values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'each' => 'each', - 'from' => 'from', - 'ids' => 'ids', - 'to' => 'to', - 'values' => 'values' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'each' => 'setEach', - 'from' => 'setFrom', - 'ids' => 'setIds', - 'to' => 'setTo', - 'values' => 'setValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'each' => 'getEach', - 'from' => 'getFrom', - 'ids' => 'getIds', - 'to' => 'getTo', - 'values' => 'getValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('each', $data ?? [], null); - $this->setIfExists('from', $data ?? [], null); - $this->setIfExists('ids', $data ?? [], null); - $this->setIfExists('to', $data ?? [], null); - $this->setIfExists('values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['each'] === null) { - $invalidProperties[] = "'each' can't be null"; - } - if ($this->container['from'] === null) { - $invalidProperties[] = "'from' can't be null"; - } - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } - if ($this->container['values'] === null) { - $invalidProperties[] = "'values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets each - * - * @return bool - */ - public function getEach() - { - return $this->container['each']; - } - - /** - * Sets each - * - * @param bool $each If `true` create an edge between each origin and destination. - * - * @return self - */ - public function setEach($each) - { - if (is_null($each)) { - throw new \InvalidArgumentException('non-nullable each cannot be null'); - } - $this->container['each'] = $each; - - return $this; - } - - /** - * Gets from - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getFrom() - { - return $this->container['from']; - } - - /** - * Sets from - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $from from - * - * @return self - */ - public function setFrom($from) - { - if (is_null($from)) { - throw new \InvalidArgumentException('non-nullable from cannot be null'); - } - $this->container['from'] = $from; - - return $this; - } - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets to - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $to to - * - * @return self - */ - public function setTo($to) - { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } - $this->container['to'] = $to; - - return $this; - } - - /** - * Gets values - * - * @return \Agnesoft\AgdbApi\Model\QueryValues - */ - public function getValues() - { - return $this->container['values']; - } - - /** - * Sets values - * - * @param \Agnesoft\AgdbApi\Model\QueryValues $values values - * - * @return self - */ - public function setValues($values) - { - if (is_null($values)) { - throw new \InvalidArgumentException('non-nullable values cannot be null'); - } - $this->container['values'] = $values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/InsertNodesQuery.php b/agdb_api/php/lib/Model/InsertNodesQuery.php deleted file mode 100644 index dec952ce..00000000 --- a/agdb_api/php/lib/Model/InsertNodesQuery.php +++ /dev/null @@ -1,533 +0,0 @@ - - */ -class InsertNodesQuery implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'InsertNodesQuery'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'aliases' => 'string[]', - 'count' => 'int', - 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'values' => '\Agnesoft\AgdbApi\Model\QueryValues' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'aliases' => null, - 'count' => 'int64', - 'ids' => null, - 'values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'aliases' => false, - 'count' => false, - 'ids' => false, - 'values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'aliases' => 'aliases', - 'count' => 'count', - 'ids' => 'ids', - 'values' => 'values' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'aliases' => 'setAliases', - 'count' => 'setCount', - 'ids' => 'setIds', - 'values' => 'setValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'aliases' => 'getAliases', - 'count' => 'getCount', - 'ids' => 'getIds', - 'values' => 'getValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('aliases', $data ?? [], null); - $this->setIfExists('count', $data ?? [], null); - $this->setIfExists('ids', $data ?? [], null); - $this->setIfExists('values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['aliases'] === null) { - $invalidProperties[] = "'aliases' can't be null"; - } - if ($this->container['count'] === null) { - $invalidProperties[] = "'count' can't be null"; - } - if (($this->container['count'] < 0)) { - $invalidProperties[] = "invalid value for 'count', must be bigger than or equal to 0."; - } - - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - if ($this->container['values'] === null) { - $invalidProperties[] = "'values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets aliases - * - * @return string[] - */ - public function getAliases() - { - return $this->container['aliases']; - } - - /** - * Sets aliases - * - * @param string[] $aliases Aliases of the new nodes. - * - * @return self - */ - public function setAliases($aliases) - { - if (is_null($aliases)) { - throw new \InvalidArgumentException('non-nullable aliases cannot be null'); - } - $this->container['aliases'] = $aliases; - - return $this; - } - - /** - * Gets count - * - * @return int - */ - public function getCount() - { - return $this->container['count']; - } - - /** - * Sets count - * - * @param int $count Number of nodes to be inserted. - * - * @return self - */ - public function setCount($count) - { - if (is_null($count)) { - throw new \InvalidArgumentException('non-nullable count cannot be null'); - } - - if (($count < 0)) { - throw new \InvalidArgumentException('invalid value for $count when calling InsertNodesQuery., must be bigger than or equal to 0.'); - } - - $this->container['count'] = $count; - - return $this; - } - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets values - * - * @return \Agnesoft\AgdbApi\Model\QueryValues - */ - public function getValues() - { - return $this->container['values']; - } - - /** - * Sets values - * - * @param \Agnesoft\AgdbApi\Model\QueryValues $values values - * - * @return self - */ - public function setValues($values) - { - if (is_null($values)) { - throw new \InvalidArgumentException('non-nullable values cannot be null'); - } - $this->container['values'] = $values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/InsertValuesQuery.php b/agdb_api/php/lib/Model/InsertValuesQuery.php deleted file mode 100644 index 39716f65..00000000 --- a/agdb_api/php/lib/Model/InsertValuesQuery.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class InsertValuesQuery implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'InsertValuesQuery'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'values' => '\Agnesoft\AgdbApi\Model\QueryValues' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'ids' => null, - 'values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'ids' => false, - 'values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'ids' => 'ids', - 'values' => 'values' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'ids' => 'setIds', - 'values' => 'setValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'ids' => 'getIds', - 'values' => 'getValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('ids', $data ?? [], null); - $this->setIfExists('values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - if ($this->container['values'] === null) { - $invalidProperties[] = "'values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets values - * - * @return \Agnesoft\AgdbApi\Model\QueryValues - */ - public function getValues() - { - return $this->container['values']; - } - - /** - * Sets values - * - * @param \Agnesoft\AgdbApi\Model\QueryValues $values values - * - * @return self - */ - public function setValues($values) - { - if (is_null($values)) { - throw new \InvalidArgumentException('non-nullable values cannot be null'); - } - $this->container['values'] = $values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ModelInterface.php b/agdb_api/php/lib/Model/ModelInterface.php deleted file mode 100644 index 36715eee..00000000 --- a/agdb_api/php/lib/Model/ModelInterface.php +++ /dev/null @@ -1,111 +0,0 @@ - - */ -class QueryAudit implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryAudit'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'query' => '\Agnesoft\AgdbApi\Model\QueryType', - 'timestamp' => 'int', - 'user' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'query' => null, - 'timestamp' => 'int64', - 'user' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'query' => false, - 'timestamp' => false, - 'user' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'query' => 'query', - 'timestamp' => 'timestamp', - 'user' => 'user' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'query' => 'setQuery', - 'timestamp' => 'setTimestamp', - 'user' => 'setUser' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'query' => 'getQuery', - 'timestamp' => 'getTimestamp', - 'user' => 'getUser' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('query', $data ?? [], null); - $this->setIfExists('timestamp', $data ?? [], null); - $this->setIfExists('user', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['query'] === null) { - $invalidProperties[] = "'query' can't be null"; - } - if ($this->container['timestamp'] === null) { - $invalidProperties[] = "'timestamp' can't be null"; - } - if (($this->container['timestamp'] < 0)) { - $invalidProperties[] = "invalid value for 'timestamp', must be bigger than or equal to 0."; - } - - if ($this->container['user'] === null) { - $invalidProperties[] = "'user' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets query - * - * @return \Agnesoft\AgdbApi\Model\QueryType - */ - public function getQuery() - { - return $this->container['query']; - } - - /** - * Sets query - * - * @param \Agnesoft\AgdbApi\Model\QueryType $query query - * - * @return self - */ - public function setQuery($query) - { - if (is_null($query)) { - throw new \InvalidArgumentException('non-nullable query cannot be null'); - } - $this->container['query'] = $query; - - return $this; - } - - /** - * Gets timestamp - * - * @return int - */ - public function getTimestamp() - { - return $this->container['timestamp']; - } - - /** - * Sets timestamp - * - * @param int $timestamp timestamp - * - * @return self - */ - public function setTimestamp($timestamp) - { - if (is_null($timestamp)) { - throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); - } - - if (($timestamp < 0)) { - throw new \InvalidArgumentException('invalid value for $timestamp when calling QueryAudit., must be bigger than or equal to 0.'); - } - - $this->container['timestamp'] = $timestamp; - - return $this; - } - - /** - * Gets user - * - * @return string - */ - public function getUser() - { - return $this->container['user']; - } - - /** - * Sets user - * - * @param string $user user - * - * @return self - */ - public function setUser($user) - { - if (is_null($user)) { - throw new \InvalidArgumentException('non-nullable user cannot be null'); - } - $this->container['user'] = $user; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryCondition.php b/agdb_api/php/lib/Model/QueryCondition.php deleted file mode 100644 index d84073c1..00000000 --- a/agdb_api/php/lib/Model/QueryCondition.php +++ /dev/null @@ -1,487 +0,0 @@ - - */ -class QueryCondition implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryCondition'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'data' => '\Agnesoft\AgdbApi\Model\QueryConditionData', - 'logic' => '\Agnesoft\AgdbApi\Model\QueryConditionLogic', - 'modifier' => '\Agnesoft\AgdbApi\Model\QueryConditionModifier' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'data' => null, - 'logic' => null, - 'modifier' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'data' => false, - 'logic' => false, - 'modifier' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'data' => 'data', - 'logic' => 'logic', - 'modifier' => 'modifier' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'data' => 'setData', - 'logic' => 'setLogic', - 'modifier' => 'setModifier' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'data' => 'getData', - 'logic' => 'getLogic', - 'modifier' => 'getModifier' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('data', $data ?? [], null); - $this->setIfExists('logic', $data ?? [], null); - $this->setIfExists('modifier', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['data'] === null) { - $invalidProperties[] = "'data' can't be null"; - } - if ($this->container['logic'] === null) { - $invalidProperties[] = "'logic' can't be null"; - } - if ($this->container['modifier'] === null) { - $invalidProperties[] = "'modifier' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets data - * - * @return \Agnesoft\AgdbApi\Model\QueryConditionData - */ - public function getData() - { - return $this->container['data']; - } - - /** - * Sets data - * - * @param \Agnesoft\AgdbApi\Model\QueryConditionData $data data - * - * @return self - */ - public function setData($data) - { - if (is_null($data)) { - throw new \InvalidArgumentException('non-nullable data cannot be null'); - } - $this->container['data'] = $data; - - return $this; - } - - /** - * Gets logic - * - * @return \Agnesoft\AgdbApi\Model\QueryConditionLogic - */ - public function getLogic() - { - return $this->container['logic']; - } - - /** - * Sets logic - * - * @param \Agnesoft\AgdbApi\Model\QueryConditionLogic $logic logic - * - * @return self - */ - public function setLogic($logic) - { - if (is_null($logic)) { - throw new \InvalidArgumentException('non-nullable logic cannot be null'); - } - $this->container['logic'] = $logic; - - return $this; - } - - /** - * Gets modifier - * - * @return \Agnesoft\AgdbApi\Model\QueryConditionModifier - */ - public function getModifier() - { - return $this->container['modifier']; - } - - /** - * Sets modifier - * - * @param \Agnesoft\AgdbApi\Model\QueryConditionModifier $modifier modifier - * - * @return self - */ - public function setModifier($modifier) - { - if (is_null($modifier)) { - throw new \InvalidArgumentException('non-nullable modifier cannot be null'); - } - $this->container['modifier'] = $modifier; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionData.php b/agdb_api/php/lib/Model/QueryConditionData.php deleted file mode 100644 index 4597bf02..00000000 --- a/agdb_api/php/lib/Model/QueryConditionData.php +++ /dev/null @@ -1,672 +0,0 @@ - - */ -class QueryConditionData implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'distance' => '\Agnesoft\AgdbApi\Model\CountComparison', - 'edge_count' => '\Agnesoft\AgdbApi\Model\CountComparison', - 'edge_count_from' => '\Agnesoft\AgdbApi\Model\CountComparison', - 'edge_count_to' => '\Agnesoft\AgdbApi\Model\CountComparison', - 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]', - 'key_value' => '\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue', - 'keys' => '\Agnesoft\AgdbApi\Model\DbValue[]', - 'where' => '\Agnesoft\AgdbApi\Model\QueryCondition[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'distance' => null, - 'edge_count' => null, - 'edge_count_from' => null, - 'edge_count_to' => null, - 'ids' => null, - 'key_value' => null, - 'keys' => null, - 'where' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'distance' => false, - 'edge_count' => false, - 'edge_count_from' => false, - 'edge_count_to' => false, - 'ids' => false, - 'key_value' => false, - 'keys' => false, - 'where' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'distance' => 'Distance', - 'edge_count' => 'EdgeCount', - 'edge_count_from' => 'EdgeCountFrom', - 'edge_count_to' => 'EdgeCountTo', - 'ids' => 'Ids', - 'key_value' => 'KeyValue', - 'keys' => 'Keys', - 'where' => 'Where' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'distance' => 'setDistance', - 'edge_count' => 'setEdgeCount', - 'edge_count_from' => 'setEdgeCountFrom', - 'edge_count_to' => 'setEdgeCountTo', - 'ids' => 'setIds', - 'key_value' => 'setKeyValue', - 'keys' => 'setKeys', - 'where' => 'setWhere' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'distance' => 'getDistance', - 'edge_count' => 'getEdgeCount', - 'edge_count_from' => 'getEdgeCountFrom', - 'edge_count_to' => 'getEdgeCountTo', - 'ids' => 'getIds', - 'key_value' => 'getKeyValue', - 'keys' => 'getKeys', - 'where' => 'getWhere' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('distance', $data ?? [], null); - $this->setIfExists('edge_count', $data ?? [], null); - $this->setIfExists('edge_count_from', $data ?? [], null); - $this->setIfExists('edge_count_to', $data ?? [], null); - $this->setIfExists('ids', $data ?? [], null); - $this->setIfExists('key_value', $data ?? [], null); - $this->setIfExists('keys', $data ?? [], null); - $this->setIfExists('where', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['distance'] === null) { - $invalidProperties[] = "'distance' can't be null"; - } - if ($this->container['edge_count'] === null) { - $invalidProperties[] = "'edge_count' can't be null"; - } - if ($this->container['edge_count_from'] === null) { - $invalidProperties[] = "'edge_count_from' can't be null"; - } - if ($this->container['edge_count_to'] === null) { - $invalidProperties[] = "'edge_count_to' can't be null"; - } - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - if ($this->container['key_value'] === null) { - $invalidProperties[] = "'key_value' can't be null"; - } - if ($this->container['keys'] === null) { - $invalidProperties[] = "'keys' can't be null"; - } - if ($this->container['where'] === null) { - $invalidProperties[] = "'where' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets distance - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getDistance() - { - return $this->container['distance']; - } - - /** - * Sets distance - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $distance distance - * - * @return self - */ - public function setDistance($distance) - { - if (is_null($distance)) { - throw new \InvalidArgumentException('non-nullable distance cannot be null'); - } - $this->container['distance'] = $distance; - - return $this; - } - - /** - * Gets edge_count - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getEdgeCount() - { - return $this->container['edge_count']; - } - - /** - * Sets edge_count - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count edge_count - * - * @return self - */ - public function setEdgeCount($edge_count) - { - if (is_null($edge_count)) { - throw new \InvalidArgumentException('non-nullable edge_count cannot be null'); - } - $this->container['edge_count'] = $edge_count; - - return $this; - } - - /** - * Gets edge_count_from - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getEdgeCountFrom() - { - return $this->container['edge_count_from']; - } - - /** - * Sets edge_count_from - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_from edge_count_from - * - * @return self - */ - public function setEdgeCountFrom($edge_count_from) - { - if (is_null($edge_count_from)) { - throw new \InvalidArgumentException('non-nullable edge_count_from cannot be null'); - } - $this->container['edge_count_from'] = $edge_count_from; - - return $this; - } - - /** - * Gets edge_count_to - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getEdgeCountTo() - { - return $this->container['edge_count_to']; - } - - /** - * Sets edge_count_to - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_to edge_count_to - * - * @return self - */ - public function setEdgeCountTo($edge_count_to) - { - if (is_null($edge_count_to)) { - throw new \InvalidArgumentException('non-nullable edge_count_to cannot be null'); - } - $this->container['edge_count_to'] = $edge_count_to; - - return $this; - } - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryId[] - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids Tests if the current id is in the list of ids. - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets key_value - * - * @return \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue - */ - public function getKeyValue() - { - return $this->container['key_value']; - } - - /** - * Sets key_value - * - * @param \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue $key_value key_value - * - * @return self - */ - public function setKeyValue($key_value) - { - if (is_null($key_value)) { - throw new \InvalidArgumentException('non-nullable key_value cannot be null'); - } - $this->container['key_value'] = $key_value; - - return $this; - } - - /** - * Gets keys - * - * @return \Agnesoft\AgdbApi\Model\DbValue[] - */ - public function getKeys() - { - return $this->container['keys']; - } - - /** - * Sets keys - * - * @param \Agnesoft\AgdbApi\Model\DbValue[] $keys Test if the current element has **all** of the keys listed. - * - * @return self - */ - public function setKeys($keys) - { - if (is_null($keys)) { - throw new \InvalidArgumentException('non-nullable keys cannot be null'); - } - $this->container['keys'] = $keys; - - return $this; - } - - /** - * Gets where - * - * @return \Agnesoft\AgdbApi\Model\QueryCondition[] - */ - public function getWhere() - { - return $this->container['where']; - } - - /** - * Sets where - * - * @param \Agnesoft\AgdbApi\Model\QueryCondition[] $where Nested list of conditions (equivalent to brackets). - * - * @return self - */ - public function setWhere($where) - { - if (is_null($where)) { - throw new \InvalidArgumentException('non-nullable where cannot be null'); - } - $this->container['where'] = $where; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf.php deleted file mode 100644 index 9920a9be..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'distance' => '\Agnesoft\AgdbApi\Model\CountComparison' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'distance' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'distance' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'distance' => 'Distance' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'distance' => 'setDistance' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'distance' => 'getDistance' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('distance', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['distance'] === null) { - $invalidProperties[] = "'distance' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets distance - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getDistance() - { - return $this->container['distance']; - } - - /** - * Sets distance - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $distance distance - * - * @return self - */ - public function setDistance($distance) - { - if (is_null($distance)) { - throw new \InvalidArgumentException('non-nullable distance cannot be null'); - } - $this->container['distance'] = $distance; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf1.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf1.php deleted file mode 100644 index 872d962f..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'edge_count' => '\Agnesoft\AgdbApi\Model\CountComparison' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'edge_count' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'edge_count' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'edge_count' => 'EdgeCount' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'edge_count' => 'setEdgeCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'edge_count' => 'getEdgeCount' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('edge_count', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['edge_count'] === null) { - $invalidProperties[] = "'edge_count' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets edge_count - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getEdgeCount() - { - return $this->container['edge_count']; - } - - /** - * Sets edge_count - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count edge_count - * - * @return self - */ - public function setEdgeCount($edge_count) - { - if (is_null($edge_count)) { - throw new \InvalidArgumentException('non-nullable edge_count cannot be null'); - } - $this->container['edge_count'] = $edge_count; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf2.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf2.php deleted file mode 100644 index 3cc441c3..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf2.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_2'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'edge_count_from' => '\Agnesoft\AgdbApi\Model\CountComparison' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'edge_count_from' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'edge_count_from' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'edge_count_from' => 'EdgeCountFrom' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'edge_count_from' => 'setEdgeCountFrom' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'edge_count_from' => 'getEdgeCountFrom' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('edge_count_from', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['edge_count_from'] === null) { - $invalidProperties[] = "'edge_count_from' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets edge_count_from - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getEdgeCountFrom() - { - return $this->container['edge_count_from']; - } - - /** - * Sets edge_count_from - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_from edge_count_from - * - * @return self - */ - public function setEdgeCountFrom($edge_count_from) - { - if (is_null($edge_count_from)) { - throw new \InvalidArgumentException('non-nullable edge_count_from cannot be null'); - } - $this->container['edge_count_from'] = $edge_count_from; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf3.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf3.php deleted file mode 100644 index 33d106ba..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf3.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_3'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'edge_count_to' => '\Agnesoft\AgdbApi\Model\CountComparison' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'edge_count_to' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'edge_count_to' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'edge_count_to' => 'EdgeCountTo' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'edge_count_to' => 'setEdgeCountTo' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'edge_count_to' => 'getEdgeCountTo' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('edge_count_to', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['edge_count_to'] === null) { - $invalidProperties[] = "'edge_count_to' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets edge_count_to - * - * @return \Agnesoft\AgdbApi\Model\CountComparison - */ - public function getEdgeCountTo() - { - return $this->container['edge_count_to']; - } - - /** - * Sets edge_count_to - * - * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_to edge_count_to - * - * @return self - */ - public function setEdgeCountTo($edge_count_to) - { - if (is_null($edge_count_to)) { - throw new \InvalidArgumentException('non-nullable edge_count_to cannot be null'); - } - $this->container['edge_count_to'] = $edge_count_to; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf4.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf4.php deleted file mode 100644 index f8247365..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf4.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_4'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'ids' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'ids' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'ids' => 'Ids' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'ids' => 'setIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'ids' => 'getIds' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('ids', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryId[] - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids Tests if the current id is in the list of ids. - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf5.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf5.php deleted file mode 100644 index 42424d7d..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf5.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_5'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'key_value' => '\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'key_value' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'key_value' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'key_value' => 'KeyValue' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'key_value' => 'setKeyValue' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'key_value' => 'getKeyValue' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('key_value', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['key_value'] === null) { - $invalidProperties[] = "'key_value' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets key_value - * - * @return \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue - */ - public function getKeyValue() - { - return $this->container['key_value']; - } - - /** - * Sets key_value - * - * @param \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue $key_value key_value - * - * @return self - */ - public function setKeyValue($key_value) - { - if (is_null($key_value)) { - throw new \InvalidArgumentException('non-nullable key_value cannot be null'); - } - $this->container['key_value'] = $key_value; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php deleted file mode 100644 index b6834813..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class QueryConditionDataOneOf5KeyValue implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_5_KeyValue'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'key' => '\Agnesoft\AgdbApi\Model\DbValue', - 'value' => '\Agnesoft\AgdbApi\Model\Comparison' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'key' => null, - 'value' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'key' => false, - 'value' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'key' => 'key', - 'value' => 'value' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'key' => 'setKey', - 'value' => 'setValue' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'key' => 'getKey', - 'value' => 'getValue' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('key', $data ?? [], null); - $this->setIfExists('value', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['key'] === null) { - $invalidProperties[] = "'key' can't be null"; - } - if ($this->container['value'] === null) { - $invalidProperties[] = "'value' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets key - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getKey() - { - return $this->container['key']; - } - - /** - * Sets key - * - * @param \Agnesoft\AgdbApi\Model\DbValue $key key - * - * @return self - */ - public function setKey($key) - { - if (is_null($key)) { - throw new \InvalidArgumentException('non-nullable key cannot be null'); - } - $this->container['key'] = $key; - - return $this; - } - - /** - * Gets value - * - * @return \Agnesoft\AgdbApi\Model\Comparison - */ - public function getValue() - { - return $this->container['value']; - } - - /** - * Sets value - * - * @param \Agnesoft\AgdbApi\Model\Comparison $value value - * - * @return self - */ - public function setValue($value) - { - if (is_null($value)) { - throw new \InvalidArgumentException('non-nullable value cannot be null'); - } - $this->container['value'] = $value; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf6.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf6.php deleted file mode 100644 index 0b732b19..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf6.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_6'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'keys' => '\Agnesoft\AgdbApi\Model\DbValue[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'keys' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'keys' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'keys' => 'Keys' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'keys' => 'setKeys' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'keys' => 'getKeys' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('keys', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['keys'] === null) { - $invalidProperties[] = "'keys' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets keys - * - * @return \Agnesoft\AgdbApi\Model\DbValue[] - */ - public function getKeys() - { - return $this->container['keys']; - } - - /** - * Sets keys - * - * @param \Agnesoft\AgdbApi\Model\DbValue[] $keys Test if the current element has **all** of the keys listed. - * - * @return self - */ - public function setKeys($keys) - { - if (is_null($keys)) { - throw new \InvalidArgumentException('non-nullable keys cannot be null'); - } - $this->container['keys'] = $keys; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf7.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf7.php deleted file mode 100644 index 3a115706..00000000 --- a/agdb_api/php/lib/Model/QueryConditionDataOneOf7.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryConditionDataOneOf7 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryConditionData_oneOf_7'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'where' => '\Agnesoft\AgdbApi\Model\QueryCondition[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'where' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'where' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'where' => 'Where' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'where' => 'setWhere' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'where' => 'getWhere' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('where', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['where'] === null) { - $invalidProperties[] = "'where' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets where - * - * @return \Agnesoft\AgdbApi\Model\QueryCondition[] - */ - public function getWhere() - { - return $this->container['where']; - } - - /** - * Sets where - * - * @param \Agnesoft\AgdbApi\Model\QueryCondition[] $where Nested list of conditions (equivalent to brackets). - * - * @return self - */ - public function setWhere($where) - { - if (is_null($where)) { - throw new \InvalidArgumentException('non-nullable where cannot be null'); - } - $this->container['where'] = $where; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryConditionLogic.php b/agdb_api/php/lib/Model/QueryConditionLogic.php deleted file mode 100644 index 0f970f9e..00000000 --- a/agdb_api/php/lib/Model/QueryConditionLogic.php +++ /dev/null @@ -1,63 +0,0 @@ - - */ -class QueryId implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryId'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'id' => 'int', - 'alias' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'id' => 'int64', - 'alias' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'id' => false, - 'alias' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'Id', - 'alias' => 'Alias' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId', - 'alias' => 'setAlias' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId', - 'alias' => 'getAlias' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('id', $data ?? [], null); - $this->setIfExists('alias', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - if ($this->container['alias'] === null) { - $invalidProperties[] = "'alias' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - - /** - * Gets alias - * - * @return string - */ - public function getAlias() - { - return $this->container['alias']; - } - - /** - * Sets alias - * - * @param string $alias String alias - * - * @return self - */ - public function setAlias($alias) - { - if (is_null($alias)) { - throw new \InvalidArgumentException('non-nullable alias cannot be null'); - } - $this->container['alias'] = $alias; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryIdOneOf.php b/agdb_api/php/lib/Model/QueryIdOneOf.php deleted file mode 100644 index d62bf3fa..00000000 --- a/agdb_api/php/lib/Model/QueryIdOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryIdOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryId_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'id' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'id' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'id' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'id' => 'Id' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'id' => 'setId' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'id' => 'getId' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('id', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['id'] === null) { - $invalidProperties[] = "'id' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets id - * - * @return int - */ - public function getId() - { - return $this->container['id']; - } - - /** - * Sets id - * - * @param int $id Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. - * - * @return self - */ - public function setId($id) - { - if (is_null($id)) { - throw new \InvalidArgumentException('non-nullable id cannot be null'); - } - $this->container['id'] = $id; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryIdOneOf1.php b/agdb_api/php/lib/Model/QueryIdOneOf1.php deleted file mode 100644 index c18d4c58..00000000 --- a/agdb_api/php/lib/Model/QueryIdOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryIdOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryId_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'alias' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'alias' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'alias' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'alias' => 'Alias' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'alias' => 'setAlias' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'alias' => 'getAlias' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('alias', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['alias'] === null) { - $invalidProperties[] = "'alias' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets alias - * - * @return string - */ - public function getAlias() - { - return $this->container['alias']; - } - - /** - * Sets alias - * - * @param string $alias String alias - * - * @return self - */ - public function setAlias($alias) - { - if (is_null($alias)) { - throw new \InvalidArgumentException('non-nullable alias cannot be null'); - } - $this->container['alias'] = $alias; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryIds.php b/agdb_api/php/lib/Model/QueryIds.php deleted file mode 100644 index 2a128593..00000000 --- a/agdb_api/php/lib/Model/QueryIds.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class QueryIds implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryIds'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]', - 'search' => '\Agnesoft\AgdbApi\Model\SearchQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'ids' => null, - 'search' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'ids' => false, - 'search' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'ids' => 'Ids', - 'search' => 'Search' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'ids' => 'setIds', - 'search' => 'setSearch' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'ids' => 'getIds', - 'search' => 'getSearch' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('ids', $data ?? [], null); - $this->setIfExists('search', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - if ($this->container['search'] === null) { - $invalidProperties[] = "'search' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryId[] - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids List of [`QueryId`]s - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets search - * - * @return \Agnesoft\AgdbApi\Model\SearchQuery - */ - public function getSearch() - { - return $this->container['search']; - } - - /** - * Sets search - * - * @param \Agnesoft\AgdbApi\Model\SearchQuery $search search - * - * @return self - */ - public function setSearch($search) - { - if (is_null($search)) { - throw new \InvalidArgumentException('non-nullable search cannot be null'); - } - $this->container['search'] = $search; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryIdsOneOf.php b/agdb_api/php/lib/Model/QueryIdsOneOf.php deleted file mode 100644 index d57a7d8a..00000000 --- a/agdb_api/php/lib/Model/QueryIdsOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryIdsOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryIds_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'ids' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'ids' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'ids' => 'Ids' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'ids' => 'setIds' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'ids' => 'getIds' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('ids', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryId[] - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids List of [`QueryId`]s - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryIdsOneOf1.php b/agdb_api/php/lib/Model/QueryIdsOneOf1.php deleted file mode 100644 index fffd1e8f..00000000 --- a/agdb_api/php/lib/Model/QueryIdsOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryIdsOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryIds_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'search' => '\Agnesoft\AgdbApi\Model\SearchQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'search' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'search' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'search' => 'Search' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'search' => 'setSearch' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'search' => 'getSearch' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('search', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['search'] === null) { - $invalidProperties[] = "'search' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets search - * - * @return \Agnesoft\AgdbApi\Model\SearchQuery - */ - public function getSearch() - { - return $this->container['search']; - } - - /** - * Sets search - * - * @param \Agnesoft\AgdbApi\Model\SearchQuery $search search - * - * @return self - */ - public function setSearch($search) - { - if (is_null($search)) { - throw new \InvalidArgumentException('non-nullable search cannot be null'); - } - $this->container['search'] = $search; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryResult.php b/agdb_api/php/lib/Model/QueryResult.php deleted file mode 100644 index c33ccd29..00000000 --- a/agdb_api/php/lib/Model/QueryResult.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class QueryResult implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryResult'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'elements' => '\Agnesoft\AgdbApi\Model\DbElement[]', - 'result' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'elements' => null, - 'result' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'elements' => false, - 'result' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'elements' => 'elements', - 'result' => 'result' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'elements' => 'setElements', - 'result' => 'setResult' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'elements' => 'getElements', - 'result' => 'getResult' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('elements', $data ?? [], null); - $this->setIfExists('result', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['elements'] === null) { - $invalidProperties[] = "'elements' can't be null"; - } - if ($this->container['result'] === null) { - $invalidProperties[] = "'result' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets elements - * - * @return \Agnesoft\AgdbApi\Model\DbElement[] - */ - public function getElements() - { - return $this->container['elements']; - } - - /** - * Sets elements - * - * @param \Agnesoft\AgdbApi\Model\DbElement[] $elements List of elements yielded by the query possibly with a list of properties. - * - * @return self - */ - public function setElements($elements) - { - if (is_null($elements)) { - throw new \InvalidArgumentException('non-nullable elements cannot be null'); - } - $this->container['elements'] = $elements; - - return $this; - } - - /** - * Gets result - * - * @return int - */ - public function getResult() - { - return $this->container['result']; - } - - /** - * Sets result - * - * @param int $result Query result - * - * @return self - */ - public function setResult($result) - { - if (is_null($result)) { - throw new \InvalidArgumentException('non-nullable result cannot be null'); - } - $this->container['result'] = $result; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryType.php b/agdb_api/php/lib/Model/QueryType.php deleted file mode 100644 index 88ca2e19..00000000 --- a/agdb_api/php/lib/Model/QueryType.php +++ /dev/null @@ -1,1042 +0,0 @@ - - */ -class QueryType implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'insert_alias' => '\Agnesoft\AgdbApi\Model\InsertAliasesQuery', - 'insert_edges' => '\Agnesoft\AgdbApi\Model\InsertEdgesQuery', - 'insert_index' => '\Agnesoft\AgdbApi\Model\DbValue', - 'insert_nodes' => '\Agnesoft\AgdbApi\Model\InsertNodesQuery', - 'insert_values' => '\Agnesoft\AgdbApi\Model\InsertValuesQuery', - 'remove' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'remove_aliases' => 'string[]', - 'remove_index' => '\Agnesoft\AgdbApi\Model\DbValue', - 'remove_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery', - 'search' => '\Agnesoft\AgdbApi\Model\SearchQuery', - 'select_aliases' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'select_all_aliases' => 'object', - 'select_edge_count' => '\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery', - 'select_indexes' => 'object', - 'select_keys' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'select_key_count' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'select_node_count' => 'object', - 'select_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'insert_alias' => null, - 'insert_edges' => null, - 'insert_index' => null, - 'insert_nodes' => null, - 'insert_values' => null, - 'remove' => null, - 'remove_aliases' => null, - 'remove_index' => null, - 'remove_values' => null, - 'search' => null, - 'select_aliases' => null, - 'select_all_aliases' => null, - 'select_edge_count' => null, - 'select_indexes' => null, - 'select_keys' => null, - 'select_key_count' => null, - 'select_node_count' => null, - 'select_values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'insert_alias' => false, - 'insert_edges' => false, - 'insert_index' => false, - 'insert_nodes' => false, - 'insert_values' => false, - 'remove' => false, - 'remove_aliases' => false, - 'remove_index' => false, - 'remove_values' => false, - 'search' => false, - 'select_aliases' => false, - 'select_all_aliases' => false, - 'select_edge_count' => false, - 'select_indexes' => false, - 'select_keys' => false, - 'select_key_count' => false, - 'select_node_count' => false, - 'select_values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'insert_alias' => 'InsertAlias', - 'insert_edges' => 'InsertEdges', - 'insert_index' => 'InsertIndex', - 'insert_nodes' => 'InsertNodes', - 'insert_values' => 'InsertValues', - 'remove' => 'Remove', - 'remove_aliases' => 'RemoveAliases', - 'remove_index' => 'RemoveIndex', - 'remove_values' => 'RemoveValues', - 'search' => 'Search', - 'select_aliases' => 'SelectAliases', - 'select_all_aliases' => 'SelectAllAliases', - 'select_edge_count' => 'SelectEdgeCount', - 'select_indexes' => 'SelectIndexes', - 'select_keys' => 'SelectKeys', - 'select_key_count' => 'SelectKeyCount', - 'select_node_count' => 'SelectNodeCount', - 'select_values' => 'SelectValues' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'insert_alias' => 'setInsertAlias', - 'insert_edges' => 'setInsertEdges', - 'insert_index' => 'setInsertIndex', - 'insert_nodes' => 'setInsertNodes', - 'insert_values' => 'setInsertValues', - 'remove' => 'setRemove', - 'remove_aliases' => 'setRemoveAliases', - 'remove_index' => 'setRemoveIndex', - 'remove_values' => 'setRemoveValues', - 'search' => 'setSearch', - 'select_aliases' => 'setSelectAliases', - 'select_all_aliases' => 'setSelectAllAliases', - 'select_edge_count' => 'setSelectEdgeCount', - 'select_indexes' => 'setSelectIndexes', - 'select_keys' => 'setSelectKeys', - 'select_key_count' => 'setSelectKeyCount', - 'select_node_count' => 'setSelectNodeCount', - 'select_values' => 'setSelectValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'insert_alias' => 'getInsertAlias', - 'insert_edges' => 'getInsertEdges', - 'insert_index' => 'getInsertIndex', - 'insert_nodes' => 'getInsertNodes', - 'insert_values' => 'getInsertValues', - 'remove' => 'getRemove', - 'remove_aliases' => 'getRemoveAliases', - 'remove_index' => 'getRemoveIndex', - 'remove_values' => 'getRemoveValues', - 'search' => 'getSearch', - 'select_aliases' => 'getSelectAliases', - 'select_all_aliases' => 'getSelectAllAliases', - 'select_edge_count' => 'getSelectEdgeCount', - 'select_indexes' => 'getSelectIndexes', - 'select_keys' => 'getSelectKeys', - 'select_key_count' => 'getSelectKeyCount', - 'select_node_count' => 'getSelectNodeCount', - 'select_values' => 'getSelectValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('insert_alias', $data ?? [], null); - $this->setIfExists('insert_edges', $data ?? [], null); - $this->setIfExists('insert_index', $data ?? [], null); - $this->setIfExists('insert_nodes', $data ?? [], null); - $this->setIfExists('insert_values', $data ?? [], null); - $this->setIfExists('remove', $data ?? [], null); - $this->setIfExists('remove_aliases', $data ?? [], null); - $this->setIfExists('remove_index', $data ?? [], null); - $this->setIfExists('remove_values', $data ?? [], null); - $this->setIfExists('search', $data ?? [], null); - $this->setIfExists('select_aliases', $data ?? [], null); - $this->setIfExists('select_all_aliases', $data ?? [], null); - $this->setIfExists('select_edge_count', $data ?? [], null); - $this->setIfExists('select_indexes', $data ?? [], null); - $this->setIfExists('select_keys', $data ?? [], null); - $this->setIfExists('select_key_count', $data ?? [], null); - $this->setIfExists('select_node_count', $data ?? [], null); - $this->setIfExists('select_values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['insert_alias'] === null) { - $invalidProperties[] = "'insert_alias' can't be null"; - } - if ($this->container['insert_edges'] === null) { - $invalidProperties[] = "'insert_edges' can't be null"; - } - if ($this->container['insert_index'] === null) { - $invalidProperties[] = "'insert_index' can't be null"; - } - if ($this->container['insert_nodes'] === null) { - $invalidProperties[] = "'insert_nodes' can't be null"; - } - if ($this->container['insert_values'] === null) { - $invalidProperties[] = "'insert_values' can't be null"; - } - if ($this->container['remove'] === null) { - $invalidProperties[] = "'remove' can't be null"; - } - if ($this->container['remove_aliases'] === null) { - $invalidProperties[] = "'remove_aliases' can't be null"; - } - if ($this->container['remove_index'] === null) { - $invalidProperties[] = "'remove_index' can't be null"; - } - if ($this->container['remove_values'] === null) { - $invalidProperties[] = "'remove_values' can't be null"; - } - if ($this->container['search'] === null) { - $invalidProperties[] = "'search' can't be null"; - } - if ($this->container['select_aliases'] === null) { - $invalidProperties[] = "'select_aliases' can't be null"; - } - if ($this->container['select_all_aliases'] === null) { - $invalidProperties[] = "'select_all_aliases' can't be null"; - } - if ($this->container['select_edge_count'] === null) { - $invalidProperties[] = "'select_edge_count' can't be null"; - } - if ($this->container['select_indexes'] === null) { - $invalidProperties[] = "'select_indexes' can't be null"; - } - if ($this->container['select_keys'] === null) { - $invalidProperties[] = "'select_keys' can't be null"; - } - if ($this->container['select_key_count'] === null) { - $invalidProperties[] = "'select_key_count' can't be null"; - } - if ($this->container['select_node_count'] === null) { - $invalidProperties[] = "'select_node_count' can't be null"; - } - if ($this->container['select_values'] === null) { - $invalidProperties[] = "'select_values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets insert_alias - * - * @return \Agnesoft\AgdbApi\Model\InsertAliasesQuery - */ - public function getInsertAlias() - { - return $this->container['insert_alias']; - } - - /** - * Sets insert_alias - * - * @param \Agnesoft\AgdbApi\Model\InsertAliasesQuery $insert_alias insert_alias - * - * @return self - */ - public function setInsertAlias($insert_alias) - { - if (is_null($insert_alias)) { - throw new \InvalidArgumentException('non-nullable insert_alias cannot be null'); - } - $this->container['insert_alias'] = $insert_alias; - - return $this; - } - - /** - * Gets insert_edges - * - * @return \Agnesoft\AgdbApi\Model\InsertEdgesQuery - */ - public function getInsertEdges() - { - return $this->container['insert_edges']; - } - - /** - * Sets insert_edges - * - * @param \Agnesoft\AgdbApi\Model\InsertEdgesQuery $insert_edges insert_edges - * - * @return self - */ - public function setInsertEdges($insert_edges) - { - if (is_null($insert_edges)) { - throw new \InvalidArgumentException('non-nullable insert_edges cannot be null'); - } - $this->container['insert_edges'] = $insert_edges; - - return $this; - } - - /** - * Gets insert_index - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getInsertIndex() - { - return $this->container['insert_index']; - } - - /** - * Sets insert_index - * - * @param \Agnesoft\AgdbApi\Model\DbValue $insert_index insert_index - * - * @return self - */ - public function setInsertIndex($insert_index) - { - if (is_null($insert_index)) { - throw new \InvalidArgumentException('non-nullable insert_index cannot be null'); - } - $this->container['insert_index'] = $insert_index; - - return $this; - } - - /** - * Gets insert_nodes - * - * @return \Agnesoft\AgdbApi\Model\InsertNodesQuery - */ - public function getInsertNodes() - { - return $this->container['insert_nodes']; - } - - /** - * Sets insert_nodes - * - * @param \Agnesoft\AgdbApi\Model\InsertNodesQuery $insert_nodes insert_nodes - * - * @return self - */ - public function setInsertNodes($insert_nodes) - { - if (is_null($insert_nodes)) { - throw new \InvalidArgumentException('non-nullable insert_nodes cannot be null'); - } - $this->container['insert_nodes'] = $insert_nodes; - - return $this; - } - - /** - * Gets insert_values - * - * @return \Agnesoft\AgdbApi\Model\InsertValuesQuery - */ - public function getInsertValues() - { - return $this->container['insert_values']; - } - - /** - * Sets insert_values - * - * @param \Agnesoft\AgdbApi\Model\InsertValuesQuery $insert_values insert_values - * - * @return self - */ - public function setInsertValues($insert_values) - { - if (is_null($insert_values)) { - throw new \InvalidArgumentException('non-nullable insert_values cannot be null'); - } - $this->container['insert_values'] = $insert_values; - - return $this; - } - - /** - * Gets remove - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getRemove() - { - return $this->container['remove']; - } - - /** - * Sets remove - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $remove remove - * - * @return self - */ - public function setRemove($remove) - { - if (is_null($remove)) { - throw new \InvalidArgumentException('non-nullable remove cannot be null'); - } - $this->container['remove'] = $remove; - - return $this; - } - - /** - * Gets remove_aliases - * - * @return string[] - */ - public function getRemoveAliases() - { - return $this->container['remove_aliases']; - } - - /** - * Sets remove_aliases - * - * @param string[] $remove_aliases Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. - * - * @return self - */ - public function setRemoveAliases($remove_aliases) - { - if (is_null($remove_aliases)) { - throw new \InvalidArgumentException('non-nullable remove_aliases cannot be null'); - } - $this->container['remove_aliases'] = $remove_aliases; - - return $this; - } - - /** - * Gets remove_index - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getRemoveIndex() - { - return $this->container['remove_index']; - } - - /** - * Sets remove_index - * - * @param \Agnesoft\AgdbApi\Model\DbValue $remove_index remove_index - * - * @return self - */ - public function setRemoveIndex($remove_index) - { - if (is_null($remove_index)) { - throw new \InvalidArgumentException('non-nullable remove_index cannot be null'); - } - $this->container['remove_index'] = $remove_index; - - return $this; - } - - /** - * Gets remove_values - * - * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery - */ - public function getRemoveValues() - { - return $this->container['remove_values']; - } - - /** - * Sets remove_values - * - * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $remove_values remove_values - * - * @return self - */ - public function setRemoveValues($remove_values) - { - if (is_null($remove_values)) { - throw new \InvalidArgumentException('non-nullable remove_values cannot be null'); - } - $this->container['remove_values'] = $remove_values; - - return $this; - } - - /** - * Gets search - * - * @return \Agnesoft\AgdbApi\Model\SearchQuery - */ - public function getSearch() - { - return $this->container['search']; - } - - /** - * Sets search - * - * @param \Agnesoft\AgdbApi\Model\SearchQuery $search search - * - * @return self - */ - public function setSearch($search) - { - if (is_null($search)) { - throw new \InvalidArgumentException('non-nullable search cannot be null'); - } - $this->container['search'] = $search; - - return $this; - } - - /** - * Gets select_aliases - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getSelectAliases() - { - return $this->container['select_aliases']; - } - - /** - * Sets select_aliases - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $select_aliases select_aliases - * - * @return self - */ - public function setSelectAliases($select_aliases) - { - if (is_null($select_aliases)) { - throw new \InvalidArgumentException('non-nullable select_aliases cannot be null'); - } - $this->container['select_aliases'] = $select_aliases; - - return $this; - } - - /** - * Gets select_all_aliases - * - * @return object - */ - public function getSelectAllAliases() - { - return $this->container['select_all_aliases']; - } - - /** - * Sets select_all_aliases - * - * @param object $select_all_aliases Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. - * - * @return self - */ - public function setSelectAllAliases($select_all_aliases) - { - if (is_null($select_all_aliases)) { - throw new \InvalidArgumentException('non-nullable select_all_aliases cannot be null'); - } - $this->container['select_all_aliases'] = $select_all_aliases; - - return $this; - } - - /** - * Gets select_edge_count - * - * @return \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery - */ - public function getSelectEdgeCount() - { - return $this->container['select_edge_count']; - } - - /** - * Sets select_edge_count - * - * @param \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery $select_edge_count select_edge_count - * - * @return self - */ - public function setSelectEdgeCount($select_edge_count) - { - if (is_null($select_edge_count)) { - throw new \InvalidArgumentException('non-nullable select_edge_count cannot be null'); - } - $this->container['select_edge_count'] = $select_edge_count; - - return $this; - } - - /** - * Gets select_indexes - * - * @return object - */ - public function getSelectIndexes() - { - return $this->container['select_indexes']; - } - - /** - * Sets select_indexes - * - * @param object $select_indexes Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. - * - * @return self - */ - public function setSelectIndexes($select_indexes) - { - if (is_null($select_indexes)) { - throw new \InvalidArgumentException('non-nullable select_indexes cannot be null'); - } - $this->container['select_indexes'] = $select_indexes; - - return $this; - } - - /** - * Gets select_keys - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getSelectKeys() - { - return $this->container['select_keys']; - } - - /** - * Sets select_keys - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $select_keys select_keys - * - * @return self - */ - public function setSelectKeys($select_keys) - { - if (is_null($select_keys)) { - throw new \InvalidArgumentException('non-nullable select_keys cannot be null'); - } - $this->container['select_keys'] = $select_keys; - - return $this; - } - - /** - * Gets select_key_count - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getSelectKeyCount() - { - return $this->container['select_key_count']; - } - - /** - * Sets select_key_count - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $select_key_count select_key_count - * - * @return self - */ - public function setSelectKeyCount($select_key_count) - { - if (is_null($select_key_count)) { - throw new \InvalidArgumentException('non-nullable select_key_count cannot be null'); - } - $this->container['select_key_count'] = $select_key_count; - - return $this; - } - - /** - * Gets select_node_count - * - * @return object - */ - public function getSelectNodeCount() - { - return $this->container['select_node_count']; - } - - /** - * Sets select_node_count - * - * @param object $select_node_count Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. - * - * @return self - */ - public function setSelectNodeCount($select_node_count) - { - if (is_null($select_node_count)) { - throw new \InvalidArgumentException('non-nullable select_node_count cannot be null'); - } - $this->container['select_node_count'] = $select_node_count; - - return $this; - } - - /** - * Gets select_values - * - * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery - */ - public function getSelectValues() - { - return $this->container['select_values']; - } - - /** - * Sets select_values - * - * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $select_values select_values - * - * @return self - */ - public function setSelectValues($select_values) - { - if (is_null($select_values)) { - throw new \InvalidArgumentException('non-nullable select_values cannot be null'); - } - $this->container['select_values'] = $select_values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf.php b/agdb_api/php/lib/Model/QueryTypeOneOf.php deleted file mode 100644 index 1c5260c8..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'insert_alias' => '\Agnesoft\AgdbApi\Model\InsertAliasesQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'insert_alias' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'insert_alias' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'insert_alias' => 'InsertAlias' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'insert_alias' => 'setInsertAlias' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'insert_alias' => 'getInsertAlias' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('insert_alias', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['insert_alias'] === null) { - $invalidProperties[] = "'insert_alias' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets insert_alias - * - * @return \Agnesoft\AgdbApi\Model\InsertAliasesQuery - */ - public function getInsertAlias() - { - return $this->container['insert_alias']; - } - - /** - * Sets insert_alias - * - * @param \Agnesoft\AgdbApi\Model\InsertAliasesQuery $insert_alias insert_alias - * - * @return self - */ - public function setInsertAlias($insert_alias) - { - if (is_null($insert_alias)) { - throw new \InvalidArgumentException('non-nullable insert_alias cannot be null'); - } - $this->container['insert_alias'] = $insert_alias; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf1.php b/agdb_api/php/lib/Model/QueryTypeOneOf1.php deleted file mode 100644 index f5a71097..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'insert_edges' => '\Agnesoft\AgdbApi\Model\InsertEdgesQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'insert_edges' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'insert_edges' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'insert_edges' => 'InsertEdges' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'insert_edges' => 'setInsertEdges' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'insert_edges' => 'getInsertEdges' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('insert_edges', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['insert_edges'] === null) { - $invalidProperties[] = "'insert_edges' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets insert_edges - * - * @return \Agnesoft\AgdbApi\Model\InsertEdgesQuery - */ - public function getInsertEdges() - { - return $this->container['insert_edges']; - } - - /** - * Sets insert_edges - * - * @param \Agnesoft\AgdbApi\Model\InsertEdgesQuery $insert_edges insert_edges - * - * @return self - */ - public function setInsertEdges($insert_edges) - { - if (is_null($insert_edges)) { - throw new \InvalidArgumentException('non-nullable insert_edges cannot be null'); - } - $this->container['insert_edges'] = $insert_edges; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf10.php b/agdb_api/php/lib/Model/QueryTypeOneOf10.php deleted file mode 100644 index d5086535..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf10.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf10 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_10'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_all_aliases' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_all_aliases' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_all_aliases' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_all_aliases' => 'SelectAllAliases' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_all_aliases' => 'setSelectAllAliases' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_all_aliases' => 'getSelectAllAliases' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_all_aliases', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_all_aliases'] === null) { - $invalidProperties[] = "'select_all_aliases' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_all_aliases - * - * @return object - */ - public function getSelectAllAliases() - { - return $this->container['select_all_aliases']; - } - - /** - * Sets select_all_aliases - * - * @param object $select_all_aliases Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. - * - * @return self - */ - public function setSelectAllAliases($select_all_aliases) - { - if (is_null($select_all_aliases)) { - throw new \InvalidArgumentException('non-nullable select_all_aliases cannot be null'); - } - $this->container['select_all_aliases'] = $select_all_aliases; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf11.php b/agdb_api/php/lib/Model/QueryTypeOneOf11.php deleted file mode 100644 index a603a1f7..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf11.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf11 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_11'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_edge_count' => '\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_edge_count' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_edge_count' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_edge_count' => 'SelectEdgeCount' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_edge_count' => 'setSelectEdgeCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_edge_count' => 'getSelectEdgeCount' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_edge_count', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_edge_count'] === null) { - $invalidProperties[] = "'select_edge_count' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_edge_count - * - * @return \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery - */ - public function getSelectEdgeCount() - { - return $this->container['select_edge_count']; - } - - /** - * Sets select_edge_count - * - * @param \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery $select_edge_count select_edge_count - * - * @return self - */ - public function setSelectEdgeCount($select_edge_count) - { - if (is_null($select_edge_count)) { - throw new \InvalidArgumentException('non-nullable select_edge_count cannot be null'); - } - $this->container['select_edge_count'] = $select_edge_count; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf12.php b/agdb_api/php/lib/Model/QueryTypeOneOf12.php deleted file mode 100644 index 9a45244b..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf12.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf12 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_12'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_indexes' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_indexes' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_indexes' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_indexes' => 'SelectIndexes' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_indexes' => 'setSelectIndexes' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_indexes' => 'getSelectIndexes' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_indexes', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_indexes'] === null) { - $invalidProperties[] = "'select_indexes' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_indexes - * - * @return object - */ - public function getSelectIndexes() - { - return $this->container['select_indexes']; - } - - /** - * Sets select_indexes - * - * @param object $select_indexes Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. - * - * @return self - */ - public function setSelectIndexes($select_indexes) - { - if (is_null($select_indexes)) { - throw new \InvalidArgumentException('non-nullable select_indexes cannot be null'); - } - $this->container['select_indexes'] = $select_indexes; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf13.php b/agdb_api/php/lib/Model/QueryTypeOneOf13.php deleted file mode 100644 index bcb1a946..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf13.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf13 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_13'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_keys' => '\Agnesoft\AgdbApi\Model\QueryIds' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_keys' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_keys' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_keys' => 'SelectKeys' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_keys' => 'setSelectKeys' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_keys' => 'getSelectKeys' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_keys', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_keys'] === null) { - $invalidProperties[] = "'select_keys' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_keys - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getSelectKeys() - { - return $this->container['select_keys']; - } - - /** - * Sets select_keys - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $select_keys select_keys - * - * @return self - */ - public function setSelectKeys($select_keys) - { - if (is_null($select_keys)) { - throw new \InvalidArgumentException('non-nullable select_keys cannot be null'); - } - $this->container['select_keys'] = $select_keys; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf14.php b/agdb_api/php/lib/Model/QueryTypeOneOf14.php deleted file mode 100644 index 25d986bf..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf14.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf14 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_14'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_key_count' => '\Agnesoft\AgdbApi\Model\QueryIds' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_key_count' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_key_count' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_key_count' => 'SelectKeyCount' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_key_count' => 'setSelectKeyCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_key_count' => 'getSelectKeyCount' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_key_count', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_key_count'] === null) { - $invalidProperties[] = "'select_key_count' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_key_count - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getSelectKeyCount() - { - return $this->container['select_key_count']; - } - - /** - * Sets select_key_count - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $select_key_count select_key_count - * - * @return self - */ - public function setSelectKeyCount($select_key_count) - { - if (is_null($select_key_count)) { - throw new \InvalidArgumentException('non-nullable select_key_count cannot be null'); - } - $this->container['select_key_count'] = $select_key_count; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf15.php b/agdb_api/php/lib/Model/QueryTypeOneOf15.php deleted file mode 100644 index 56877cce..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf15.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf15 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_15'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_node_count' => 'object' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_node_count' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_node_count' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_node_count' => 'SelectNodeCount' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_node_count' => 'setSelectNodeCount' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_node_count' => 'getSelectNodeCount' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_node_count', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_node_count'] === null) { - $invalidProperties[] = "'select_node_count' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_node_count - * - * @return object - */ - public function getSelectNodeCount() - { - return $this->container['select_node_count']; - } - - /** - * Sets select_node_count - * - * @param object $select_node_count Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. - * - * @return self - */ - public function setSelectNodeCount($select_node_count) - { - if (is_null($select_node_count)) { - throw new \InvalidArgumentException('non-nullable select_node_count cannot be null'); - } - $this->container['select_node_count'] = $select_node_count; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf16.php b/agdb_api/php/lib/Model/QueryTypeOneOf16.php deleted file mode 100644 index d4866bb2..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf16.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf16 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_16'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_values' => 'SelectValues' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_values' => 'setSelectValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_values' => 'getSelectValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_values'] === null) { - $invalidProperties[] = "'select_values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_values - * - * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery - */ - public function getSelectValues() - { - return $this->container['select_values']; - } - - /** - * Sets select_values - * - * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $select_values select_values - * - * @return self - */ - public function setSelectValues($select_values) - { - if (is_null($select_values)) { - throw new \InvalidArgumentException('non-nullable select_values cannot be null'); - } - $this->container['select_values'] = $select_values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf2.php b/agdb_api/php/lib/Model/QueryTypeOneOf2.php deleted file mode 100644 index 0e33cae2..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf2.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_2'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'insert_index' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'insert_index' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'insert_index' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'insert_index' => 'InsertIndex' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'insert_index' => 'setInsertIndex' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'insert_index' => 'getInsertIndex' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('insert_index', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['insert_index'] === null) { - $invalidProperties[] = "'insert_index' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets insert_index - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getInsertIndex() - { - return $this->container['insert_index']; - } - - /** - * Sets insert_index - * - * @param \Agnesoft\AgdbApi\Model\DbValue $insert_index insert_index - * - * @return self - */ - public function setInsertIndex($insert_index) - { - if (is_null($insert_index)) { - throw new \InvalidArgumentException('non-nullable insert_index cannot be null'); - } - $this->container['insert_index'] = $insert_index; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf3.php b/agdb_api/php/lib/Model/QueryTypeOneOf3.php deleted file mode 100644 index 1a9a5a49..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf3.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_3'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'insert_nodes' => '\Agnesoft\AgdbApi\Model\InsertNodesQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'insert_nodes' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'insert_nodes' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'insert_nodes' => 'InsertNodes' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'insert_nodes' => 'setInsertNodes' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'insert_nodes' => 'getInsertNodes' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('insert_nodes', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['insert_nodes'] === null) { - $invalidProperties[] = "'insert_nodes' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets insert_nodes - * - * @return \Agnesoft\AgdbApi\Model\InsertNodesQuery - */ - public function getInsertNodes() - { - return $this->container['insert_nodes']; - } - - /** - * Sets insert_nodes - * - * @param \Agnesoft\AgdbApi\Model\InsertNodesQuery $insert_nodes insert_nodes - * - * @return self - */ - public function setInsertNodes($insert_nodes) - { - if (is_null($insert_nodes)) { - throw new \InvalidArgumentException('non-nullable insert_nodes cannot be null'); - } - $this->container['insert_nodes'] = $insert_nodes; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf4.php b/agdb_api/php/lib/Model/QueryTypeOneOf4.php deleted file mode 100644 index 9769eba2..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf4.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_4'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'insert_values' => '\Agnesoft\AgdbApi\Model\InsertValuesQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'insert_values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'insert_values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'insert_values' => 'InsertValues' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'insert_values' => 'setInsertValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'insert_values' => 'getInsertValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('insert_values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['insert_values'] === null) { - $invalidProperties[] = "'insert_values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets insert_values - * - * @return \Agnesoft\AgdbApi\Model\InsertValuesQuery - */ - public function getInsertValues() - { - return $this->container['insert_values']; - } - - /** - * Sets insert_values - * - * @param \Agnesoft\AgdbApi\Model\InsertValuesQuery $insert_values insert_values - * - * @return self - */ - public function setInsertValues($insert_values) - { - if (is_null($insert_values)) { - throw new \InvalidArgumentException('non-nullable insert_values cannot be null'); - } - $this->container['insert_values'] = $insert_values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf5.php b/agdb_api/php/lib/Model/QueryTypeOneOf5.php deleted file mode 100644 index 95efe46b..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf5.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_5'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'remove' => '\Agnesoft\AgdbApi\Model\QueryIds' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'remove' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'remove' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'remove' => 'Remove' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'remove' => 'setRemove' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'remove' => 'getRemove' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('remove', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['remove'] === null) { - $invalidProperties[] = "'remove' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets remove - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getRemove() - { - return $this->container['remove']; - } - - /** - * Sets remove - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $remove remove - * - * @return self - */ - public function setRemove($remove) - { - if (is_null($remove)) { - throw new \InvalidArgumentException('non-nullable remove cannot be null'); - } - $this->container['remove'] = $remove; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf6.php b/agdb_api/php/lib/Model/QueryTypeOneOf6.php deleted file mode 100644 index b42c2a0c..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf6.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_6'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'remove_aliases' => 'string[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'remove_aliases' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'remove_aliases' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'remove_aliases' => 'RemoveAliases' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'remove_aliases' => 'setRemoveAliases' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'remove_aliases' => 'getRemoveAliases' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('remove_aliases', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['remove_aliases'] === null) { - $invalidProperties[] = "'remove_aliases' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets remove_aliases - * - * @return string[] - */ - public function getRemoveAliases() - { - return $this->container['remove_aliases']; - } - - /** - * Sets remove_aliases - * - * @param string[] $remove_aliases Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. - * - * @return self - */ - public function setRemoveAliases($remove_aliases) - { - if (is_null($remove_aliases)) { - throw new \InvalidArgumentException('non-nullable remove_aliases cannot be null'); - } - $this->container['remove_aliases'] = $remove_aliases; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf7.php b/agdb_api/php/lib/Model/QueryTypeOneOf7.php deleted file mode 100644 index b949af79..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf7.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf7 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_7'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'remove_index' => '\Agnesoft\AgdbApi\Model\DbValue' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'remove_index' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'remove_index' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'remove_index' => 'RemoveIndex' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'remove_index' => 'setRemoveIndex' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'remove_index' => 'getRemoveIndex' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('remove_index', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['remove_index'] === null) { - $invalidProperties[] = "'remove_index' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets remove_index - * - * @return \Agnesoft\AgdbApi\Model\DbValue - */ - public function getRemoveIndex() - { - return $this->container['remove_index']; - } - - /** - * Sets remove_index - * - * @param \Agnesoft\AgdbApi\Model\DbValue $remove_index remove_index - * - * @return self - */ - public function setRemoveIndex($remove_index) - { - if (is_null($remove_index)) { - throw new \InvalidArgumentException('non-nullable remove_index cannot be null'); - } - $this->container['remove_index'] = $remove_index; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf8.php b/agdb_api/php/lib/Model/QueryTypeOneOf8.php deleted file mode 100644 index 24ef1dd9..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf8.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf8 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_8'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'remove_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'remove_values' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'remove_values' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'remove_values' => 'RemoveValues' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'remove_values' => 'setRemoveValues' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'remove_values' => 'getRemoveValues' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('remove_values', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['remove_values'] === null) { - $invalidProperties[] = "'remove_values' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets remove_values - * - * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery - */ - public function getRemoveValues() - { - return $this->container['remove_values']; - } - - /** - * Sets remove_values - * - * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $remove_values remove_values - * - * @return self - */ - public function setRemoveValues($remove_values) - { - if (is_null($remove_values)) { - throw new \InvalidArgumentException('non-nullable remove_values cannot be null'); - } - $this->container['remove_values'] = $remove_values; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf9.php b/agdb_api/php/lib/Model/QueryTypeOneOf9.php deleted file mode 100644 index 305fd318..00000000 --- a/agdb_api/php/lib/Model/QueryTypeOneOf9.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryTypeOneOf9 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryType_oneOf_9'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'select_aliases' => '\Agnesoft\AgdbApi\Model\QueryIds' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'select_aliases' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'select_aliases' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'select_aliases' => 'SelectAliases' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'select_aliases' => 'setSelectAliases' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'select_aliases' => 'getSelectAliases' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('select_aliases', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['select_aliases'] === null) { - $invalidProperties[] = "'select_aliases' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets select_aliases - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getSelectAliases() - { - return $this->container['select_aliases']; - } - - /** - * Sets select_aliases - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $select_aliases select_aliases - * - * @return self - */ - public function setSelectAliases($select_aliases) - { - if (is_null($select_aliases)) { - throw new \InvalidArgumentException('non-nullable select_aliases cannot be null'); - } - $this->container['select_aliases'] = $select_aliases; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryValues.php b/agdb_api/php/lib/Model/QueryValues.php deleted file mode 100644 index 361a349b..00000000 --- a/agdb_api/php/lib/Model/QueryValues.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class QueryValues implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryValues'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'single' => '\Agnesoft\AgdbApi\Model\DbKeyValue[]', - 'multi' => '\Agnesoft\AgdbApi\Model\DbKeyValue[][]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'single' => null, - 'multi' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'single' => false, - 'multi' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'single' => 'Single', - 'multi' => 'Multi' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'single' => 'setSingle', - 'multi' => 'setMulti' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'single' => 'getSingle', - 'multi' => 'getMulti' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('single', $data ?? [], null); - $this->setIfExists('multi', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['single'] === null) { - $invalidProperties[] = "'single' can't be null"; - } - if ($this->container['multi'] === null) { - $invalidProperties[] = "'multi' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets single - * - * @return \Agnesoft\AgdbApi\Model\DbKeyValue[] - */ - public function getSingle() - { - return $this->container['single']; - } - - /** - * Sets single - * - * @param \Agnesoft\AgdbApi\Model\DbKeyValue[] $single Single list of properties (key-value pairs) to be applied to all elements in a query. - * - * @return self - */ - public function setSingle($single) - { - if (is_null($single)) { - throw new \InvalidArgumentException('non-nullable single cannot be null'); - } - $this->container['single'] = $single; - - return $this; - } - - /** - * Gets multi - * - * @return \Agnesoft\AgdbApi\Model\DbKeyValue[][] - */ - public function getMulti() - { - return $this->container['multi']; - } - - /** - * Sets multi - * - * @param \Agnesoft\AgdbApi\Model\DbKeyValue[][] $multi List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. - * - * @return self - */ - public function setMulti($multi) - { - if (is_null($multi)) { - throw new \InvalidArgumentException('non-nullable multi cannot be null'); - } - $this->container['multi'] = $multi; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryValuesOneOf.php b/agdb_api/php/lib/Model/QueryValuesOneOf.php deleted file mode 100644 index 481f23e5..00000000 --- a/agdb_api/php/lib/Model/QueryValuesOneOf.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryValuesOneOf implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryValues_oneOf'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'single' => '\Agnesoft\AgdbApi\Model\DbKeyValue[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'single' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'single' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'single' => 'Single' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'single' => 'setSingle' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'single' => 'getSingle' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('single', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['single'] === null) { - $invalidProperties[] = "'single' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets single - * - * @return \Agnesoft\AgdbApi\Model\DbKeyValue[] - */ - public function getSingle() - { - return $this->container['single']; - } - - /** - * Sets single - * - * @param \Agnesoft\AgdbApi\Model\DbKeyValue[] $single Single list of properties (key-value pairs) to be applied to all elements in a query. - * - * @return self - */ - public function setSingle($single) - { - if (is_null($single)) { - throw new \InvalidArgumentException('non-nullable single cannot be null'); - } - $this->container['single'] = $single; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/QueryValuesOneOf1.php b/agdb_api/php/lib/Model/QueryValuesOneOf1.php deleted file mode 100644 index 40e5878b..00000000 --- a/agdb_api/php/lib/Model/QueryValuesOneOf1.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class QueryValuesOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'QueryValues_oneOf_1'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'multi' => '\Agnesoft\AgdbApi\Model\DbKeyValue[][]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'multi' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'multi' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'multi' => 'Multi' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'multi' => 'setMulti' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'multi' => 'getMulti' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('multi', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['multi'] === null) { - $invalidProperties[] = "'multi' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets multi - * - * @return \Agnesoft\AgdbApi\Model\DbKeyValue[][] - */ - public function getMulti() - { - return $this->container['multi']; - } - - /** - * Sets multi - * - * @param \Agnesoft\AgdbApi\Model\DbKeyValue[][] $multi List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. - * - * @return self - */ - public function setMulti($multi) - { - if (is_null($multi)) { - throw new \InvalidArgumentException('non-nullable multi cannot be null'); - } - $this->container['multi'] = $multi; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/SearchQuery.php b/agdb_api/php/lib/Model/SearchQuery.php deleted file mode 100644 index a054fd25..00000000 --- a/agdb_api/php/lib/Model/SearchQuery.php +++ /dev/null @@ -1,653 +0,0 @@ - - */ -class SearchQuery implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SearchQuery'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'algorithm' => '\Agnesoft\AgdbApi\Model\SearchQueryAlgorithm', - 'conditions' => '\Agnesoft\AgdbApi\Model\QueryCondition[]', - 'destination' => '\Agnesoft\AgdbApi\Model\QueryId', - 'limit' => 'int', - 'offset' => 'int', - 'order_by' => '\Agnesoft\AgdbApi\Model\DbKeyOrder[]', - 'origin' => '\Agnesoft\AgdbApi\Model\QueryId' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'algorithm' => null, - 'conditions' => null, - 'destination' => null, - 'limit' => 'int64', - 'offset' => 'int64', - 'order_by' => null, - 'origin' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'algorithm' => false, - 'conditions' => false, - 'destination' => false, - 'limit' => false, - 'offset' => false, - 'order_by' => false, - 'origin' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'algorithm' => 'algorithm', - 'conditions' => 'conditions', - 'destination' => 'destination', - 'limit' => 'limit', - 'offset' => 'offset', - 'order_by' => 'order_by', - 'origin' => 'origin' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'algorithm' => 'setAlgorithm', - 'conditions' => 'setConditions', - 'destination' => 'setDestination', - 'limit' => 'setLimit', - 'offset' => 'setOffset', - 'order_by' => 'setOrderBy', - 'origin' => 'setOrigin' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'algorithm' => 'getAlgorithm', - 'conditions' => 'getConditions', - 'destination' => 'getDestination', - 'limit' => 'getLimit', - 'offset' => 'getOffset', - 'order_by' => 'getOrderBy', - 'origin' => 'getOrigin' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('algorithm', $data ?? [], null); - $this->setIfExists('conditions', $data ?? [], null); - $this->setIfExists('destination', $data ?? [], null); - $this->setIfExists('limit', $data ?? [], null); - $this->setIfExists('offset', $data ?? [], null); - $this->setIfExists('order_by', $data ?? [], null); - $this->setIfExists('origin', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['algorithm'] === null) { - $invalidProperties[] = "'algorithm' can't be null"; - } - if ($this->container['conditions'] === null) { - $invalidProperties[] = "'conditions' can't be null"; - } - if ($this->container['destination'] === null) { - $invalidProperties[] = "'destination' can't be null"; - } - if ($this->container['limit'] === null) { - $invalidProperties[] = "'limit' can't be null"; - } - if (($this->container['limit'] < 0)) { - $invalidProperties[] = "invalid value for 'limit', must be bigger than or equal to 0."; - } - - if ($this->container['offset'] === null) { - $invalidProperties[] = "'offset' can't be null"; - } - if (($this->container['offset'] < 0)) { - $invalidProperties[] = "invalid value for 'offset', must be bigger than or equal to 0."; - } - - if ($this->container['order_by'] === null) { - $invalidProperties[] = "'order_by' can't be null"; - } - if ($this->container['origin'] === null) { - $invalidProperties[] = "'origin' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets algorithm - * - * @return \Agnesoft\AgdbApi\Model\SearchQueryAlgorithm - */ - public function getAlgorithm() - { - return $this->container['algorithm']; - } - - /** - * Sets algorithm - * - * @param \Agnesoft\AgdbApi\Model\SearchQueryAlgorithm $algorithm algorithm - * - * @return self - */ - public function setAlgorithm($algorithm) - { - if (is_null($algorithm)) { - throw new \InvalidArgumentException('non-nullable algorithm cannot be null'); - } - $this->container['algorithm'] = $algorithm; - - return $this; - } - - /** - * Gets conditions - * - * @return \Agnesoft\AgdbApi\Model\QueryCondition[] - */ - public function getConditions() - { - return $this->container['conditions']; - } - - /** - * Sets conditions - * - * @param \Agnesoft\AgdbApi\Model\QueryCondition[] $conditions Set of conditions every element must satisfy to be included in the result. Some conditions also influence the search path as well. - * - * @return self - */ - public function setConditions($conditions) - { - if (is_null($conditions)) { - throw new \InvalidArgumentException('non-nullable conditions cannot be null'); - } - $this->container['conditions'] = $conditions; - - return $this; - } - - /** - * Gets destination - * - * @return \Agnesoft\AgdbApi\Model\QueryId - */ - public function getDestination() - { - return $this->container['destination']; - } - - /** - * Sets destination - * - * @param \Agnesoft\AgdbApi\Model\QueryId $destination destination - * - * @return self - */ - public function setDestination($destination) - { - if (is_null($destination)) { - throw new \InvalidArgumentException('non-nullable destination cannot be null'); - } - $this->container['destination'] = $destination; - - return $this; - } - - /** - * Gets limit - * - * @return int - */ - public function getLimit() - { - return $this->container['limit']; - } - - /** - * Sets limit - * - * @param int $limit How many elements maximum to return. - * - * @return self - */ - public function setLimit($limit) - { - if (is_null($limit)) { - throw new \InvalidArgumentException('non-nullable limit cannot be null'); - } - - if (($limit < 0)) { - throw new \InvalidArgumentException('invalid value for $limit when calling SearchQuery., must be bigger than or equal to 0.'); - } - - $this->container['limit'] = $limit; - - return $this; - } - - /** - * Gets offset - * - * @return int - */ - public function getOffset() - { - return $this->container['offset']; - } - - /** - * Sets offset - * - * @param int $offset How many elements that would be returned should be skipped in the result. - * - * @return self - */ - public function setOffset($offset) - { - if (is_null($offset)) { - throw new \InvalidArgumentException('non-nullable offset cannot be null'); - } - - if (($offset < 0)) { - throw new \InvalidArgumentException('invalid value for $offset when calling SearchQuery., must be bigger than or equal to 0.'); - } - - $this->container['offset'] = $offset; - - return $this; - } - - /** - * Gets order_by - * - * @return \Agnesoft\AgdbApi\Model\DbKeyOrder[] - */ - public function getOrderBy() - { - return $this->container['order_by']; - } - - /** - * Sets order_by - * - * @param \Agnesoft\AgdbApi\Model\DbKeyOrder[] $order_by Order of the elements in the result. The sorting happens before `offset` and `limit` are applied. - * - * @return self - */ - public function setOrderBy($order_by) - { - if (is_null($order_by)) { - throw new \InvalidArgumentException('non-nullable order_by cannot be null'); - } - $this->container['order_by'] = $order_by; - - return $this; - } - - /** - * Gets origin - * - * @return \Agnesoft\AgdbApi\Model\QueryId - */ - public function getOrigin() - { - return $this->container['origin']; - } - - /** - * Sets origin - * - * @param \Agnesoft\AgdbApi\Model\QueryId $origin origin - * - * @return self - */ - public function setOrigin($origin) - { - if (is_null($origin)) { - throw new \InvalidArgumentException('non-nullable origin cannot be null'); - } - $this->container['origin'] = $origin; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/SearchQueryAlgorithm.php b/agdb_api/php/lib/Model/SearchQueryAlgorithm.php deleted file mode 100644 index 86b558e9..00000000 --- a/agdb_api/php/lib/Model/SearchQueryAlgorithm.php +++ /dev/null @@ -1,69 +0,0 @@ - - */ -class SelectEdgeCountQuery implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SelectEdgeCountQuery'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'from' => 'bool', - 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'to' => 'bool' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'from' => null, - 'ids' => null, - 'to' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'from' => false, - 'ids' => false, - 'to' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'from' => 'from', - 'ids' => 'ids', - 'to' => 'to' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'from' => 'setFrom', - 'ids' => 'setIds', - 'to' => 'setTo' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'from' => 'getFrom', - 'ids' => 'getIds', - 'to' => 'getTo' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('from', $data ?? [], null); - $this->setIfExists('ids', $data ?? [], null); - $this->setIfExists('to', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['from'] === null) { - $invalidProperties[] = "'from' can't be null"; - } - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - if ($this->container['to'] === null) { - $invalidProperties[] = "'to' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets from - * - * @return bool - */ - public function getFrom() - { - return $this->container['from']; - } - - /** - * Sets from - * - * @param bool $from If set to `true` the query will count outgoing edges from the nodes. - * - * @return self - */ - public function setFrom($from) - { - if (is_null($from)) { - throw new \InvalidArgumentException('non-nullable from cannot be null'); - } - $this->container['from'] = $from; - - return $this; - } - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets to - * - * @return bool - */ - public function getTo() - { - return $this->container['to']; - } - - /** - * Sets to - * - * @param bool $to If set to `true` the query will count incoming edges to the nodes. - * - * @return self - */ - public function setTo($to) - { - if (is_null($to)) { - throw new \InvalidArgumentException('non-nullable to cannot be null'); - } - $this->container['to'] = $to; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/SelectValuesQuery.php b/agdb_api/php/lib/Model/SelectValuesQuery.php deleted file mode 100644 index 9f41b4a4..00000000 --- a/agdb_api/php/lib/Model/SelectValuesQuery.php +++ /dev/null @@ -1,450 +0,0 @@ - - */ -class SelectValuesQuery implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'SelectValuesQuery'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', - 'keys' => '\Agnesoft\AgdbApi\Model\DbValue[]' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'ids' => null, - 'keys' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'ids' => false, - 'keys' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'ids' => 'ids', - 'keys' => 'keys' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'ids' => 'setIds', - 'keys' => 'setKeys' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'ids' => 'getIds', - 'keys' => 'getKeys' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('ids', $data ?? [], null); - $this->setIfExists('keys', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['ids'] === null) { - $invalidProperties[] = "'ids' can't be null"; - } - if ($this->container['keys'] === null) { - $invalidProperties[] = "'keys' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets ids - * - * @return \Agnesoft\AgdbApi\Model\QueryIds - */ - public function getIds() - { - return $this->container['ids']; - } - - /** - * Sets ids - * - * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids - * - * @return self - */ - public function setIds($ids) - { - if (is_null($ids)) { - throw new \InvalidArgumentException('non-nullable ids cannot be null'); - } - $this->container['ids'] = $ids; - - return $this; - } - - /** - * Gets keys - * - * @return \Agnesoft\AgdbApi\Model\DbValue[] - */ - public function getKeys() - { - return $this->container['keys']; - } - - /** - * Sets keys - * - * @param \Agnesoft\AgdbApi\Model\DbValue[] $keys keys - * - * @return self - */ - public function setKeys($keys) - { - if (is_null($keys)) { - throw new \InvalidArgumentException('non-nullable keys cannot be null'); - } - $this->container['keys'] = $keys; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ServerDatabase.php b/agdb_api/php/lib/Model/ServerDatabase.php deleted file mode 100644 index 7a67582d..00000000 --- a/agdb_api/php/lib/Model/ServerDatabase.php +++ /dev/null @@ -1,578 +0,0 @@ - - */ -class ServerDatabase implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ServerDatabase'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'backup' => 'int', - 'db_type' => '\Agnesoft\AgdbApi\Model\DbType', - 'name' => 'string', - 'role' => '\Agnesoft\AgdbApi\Model\DbUserRole', - 'size' => 'int' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'backup' => 'int64', - 'db_type' => null, - 'name' => null, - 'role' => null, - 'size' => 'int64' - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'backup' => false, - 'db_type' => false, - 'name' => false, - 'role' => false, - 'size' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'backup' => 'backup', - 'db_type' => 'db_type', - 'name' => 'name', - 'role' => 'role', - 'size' => 'size' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'backup' => 'setBackup', - 'db_type' => 'setDbType', - 'name' => 'setName', - 'role' => 'setRole', - 'size' => 'setSize' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'backup' => 'getBackup', - 'db_type' => 'getDbType', - 'name' => 'getName', - 'role' => 'getRole', - 'size' => 'getSize' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('backup', $data ?? [], null); - $this->setIfExists('db_type', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - $this->setIfExists('role', $data ?? [], null); - $this->setIfExists('size', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['backup'] === null) { - $invalidProperties[] = "'backup' can't be null"; - } - if (($this->container['backup'] < 0)) { - $invalidProperties[] = "invalid value for 'backup', must be bigger than or equal to 0."; - } - - if ($this->container['db_type'] === null) { - $invalidProperties[] = "'db_type' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - if ($this->container['role'] === null) { - $invalidProperties[] = "'role' can't be null"; - } - if ($this->container['size'] === null) { - $invalidProperties[] = "'size' can't be null"; - } - if (($this->container['size'] < 0)) { - $invalidProperties[] = "invalid value for 'size', must be bigger than or equal to 0."; - } - - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets backup - * - * @return int - */ - public function getBackup() - { - return $this->container['backup']; - } - - /** - * Sets backup - * - * @param int $backup backup - * - * @return self - */ - public function setBackup($backup) - { - if (is_null($backup)) { - throw new \InvalidArgumentException('non-nullable backup cannot be null'); - } - - if (($backup < 0)) { - throw new \InvalidArgumentException('invalid value for $backup when calling ServerDatabase., must be bigger than or equal to 0.'); - } - - $this->container['backup'] = $backup; - - return $this; - } - - /** - * Gets db_type - * - * @return \Agnesoft\AgdbApi\Model\DbType - */ - public function getDbType() - { - return $this->container['db_type']; - } - - /** - * Sets db_type - * - * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type - * - * @return self - */ - public function setDbType($db_type) - { - if (is_null($db_type)) { - throw new \InvalidArgumentException('non-nullable db_type cannot be null'); - } - $this->container['db_type'] = $db_type; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name name - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - - /** - * Gets role - * - * @return \Agnesoft\AgdbApi\Model\DbUserRole - */ - public function getRole() - { - return $this->container['role']; - } - - /** - * Sets role - * - * @param \Agnesoft\AgdbApi\Model\DbUserRole $role role - * - * @return self - */ - public function setRole($role) - { - if (is_null($role)) { - throw new \InvalidArgumentException('non-nullable role cannot be null'); - } - $this->container['role'] = $role; - - return $this; - } - - /** - * Gets size - * - * @return int - */ - public function getSize() - { - return $this->container['size']; - } - - /** - * Sets size - * - * @param int $size size - * - * @return self - */ - public function setSize($size) - { - if (is_null($size)) { - throw new \InvalidArgumentException('non-nullable size cannot be null'); - } - - if (($size < 0)) { - throw new \InvalidArgumentException('invalid value for $size when calling ServerDatabase., must be bigger than or equal to 0.'); - } - - $this->container['size'] = $size; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ServerDatabaseRename.php b/agdb_api/php/lib/Model/ServerDatabaseRename.php deleted file mode 100644 index 33340354..00000000 --- a/agdb_api/php/lib/Model/ServerDatabaseRename.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ServerDatabaseRename implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ServerDatabaseRename'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'new_name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'new_name' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'new_name' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'new_name' => 'new_name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'new_name' => 'setNewName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'new_name' => 'getNewName' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('new_name', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['new_name'] === null) { - $invalidProperties[] = "'new_name' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets new_name - * - * @return string - */ - public function getNewName() - { - return $this->container['new_name']; - } - - /** - * Sets new_name - * - * @param string $new_name new_name - * - * @return self - */ - public function setNewName($new_name) - { - if (is_null($new_name)) { - throw new \InvalidArgumentException('non-nullable new_name cannot be null'); - } - $this->container['new_name'] = $new_name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/ServerDatabaseResource.php b/agdb_api/php/lib/Model/ServerDatabaseResource.php deleted file mode 100644 index 87915f77..00000000 --- a/agdb_api/php/lib/Model/ServerDatabaseResource.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class ServerDatabaseResource implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'ServerDatabaseResource'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'resource' => '\Agnesoft\AgdbApi\Model\DbResource' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'resource' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'resource' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'resource' => 'resource' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'resource' => 'setResource' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'resource' => 'getResource' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('resource', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['resource'] === null) { - $invalidProperties[] = "'resource' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets resource - * - * @return \Agnesoft\AgdbApi\Model\DbResource - */ - public function getResource() - { - return $this->container['resource']; - } - - /** - * Sets resource - * - * @param \Agnesoft\AgdbApi\Model\DbResource $resource resource - * - * @return self - */ - public function setResource($resource) - { - if (is_null($resource)) { - throw new \InvalidArgumentException('non-nullable resource cannot be null'); - } - $this->container['resource'] = $resource; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/UserCredentials.php b/agdb_api/php/lib/Model/UserCredentials.php deleted file mode 100644 index 55dfc668..00000000 --- a/agdb_api/php/lib/Model/UserCredentials.php +++ /dev/null @@ -1,412 +0,0 @@ - - */ -class UserCredentials implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'UserCredentials'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'password' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'password' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'password' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'password' => 'password' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'password' => 'setPassword' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'password' => 'getPassword' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('password', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['password'] === null) { - $invalidProperties[] = "'password' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password password - * - * @return self - */ - public function setPassword($password) - { - if (is_null($password)) { - throw new \InvalidArgumentException('non-nullable password cannot be null'); - } - $this->container['password'] = $password; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/UserLogin.php b/agdb_api/php/lib/Model/UserLogin.php deleted file mode 100644 index bd301d08..00000000 --- a/agdb_api/php/lib/Model/UserLogin.php +++ /dev/null @@ -1,449 +0,0 @@ - - */ -class UserLogin implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'UserLogin'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'password' => 'string', - 'username' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'password' => null, - 'username' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'password' => false, - 'username' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'password' => 'password', - 'username' => 'username' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'password' => 'setPassword', - 'username' => 'setUsername' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'password' => 'getPassword', - 'username' => 'getUsername' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('password', $data ?? [], null); - $this->setIfExists('username', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['password'] === null) { - $invalidProperties[] = "'password' can't be null"; - } - if ($this->container['username'] === null) { - $invalidProperties[] = "'username' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets password - * - * @return string - */ - public function getPassword() - { - return $this->container['password']; - } - - /** - * Sets password - * - * @param string $password password - * - * @return self - */ - public function setPassword($password) - { - if (is_null($password)) { - throw new \InvalidArgumentException('non-nullable password cannot be null'); - } - $this->container['password'] = $password; - - return $this; - } - - /** - * Gets username - * - * @return string - */ - public function getUsername() - { - return $this->container['username']; - } - - /** - * Sets username - * - * @param string $username username - * - * @return self - */ - public function setUsername($username) - { - if (is_null($username)) { - throw new \InvalidArgumentException('non-nullable username cannot be null'); - } - $this->container['username'] = $username; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/Model/UserStatus.php b/agdb_api/php/lib/Model/UserStatus.php deleted file mode 100644 index b07d2f55..00000000 --- a/agdb_api/php/lib/Model/UserStatus.php +++ /dev/null @@ -1,486 +0,0 @@ - - */ -class UserStatus implements ModelInterface, ArrayAccess, \JsonSerializable -{ - public const DISCRIMINATOR = null; - - /** - * The original name of the model. - * - * @var string - */ - protected static $openAPIModelName = 'UserStatus'; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @var string[] - */ - protected static $openAPITypes = [ - 'admin' => 'bool', - 'login' => 'bool', - 'name' => 'string' - ]; - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @var string[] - * @phpstan-var array - * @psalm-var array - */ - protected static $openAPIFormats = [ - 'admin' => null, - 'login' => null, - 'name' => null - ]; - - /** - * Array of nullable properties. Used for (de)serialization - * - * @var boolean[] - */ - protected static array $openAPINullables = [ - 'admin' => false, - 'login' => false, - 'name' => false - ]; - - /** - * If a nullable field gets set to null, insert it here - * - * @var boolean[] - */ - protected array $openAPINullablesSetToNull = []; - - /** - * Array of property to type mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPITypes() - { - return self::$openAPITypes; - } - - /** - * Array of property to format mappings. Used for (de)serialization - * - * @return array - */ - public static function openAPIFormats() - { - return self::$openAPIFormats; - } - - /** - * Array of nullable properties - * - * @return array - */ - protected static function openAPINullables(): array - { - return self::$openAPINullables; - } - - /** - * Array of nullable field names deliberately set to null - * - * @return boolean[] - */ - private function getOpenAPINullablesSetToNull(): array - { - return $this->openAPINullablesSetToNull; - } - - /** - * Setter - Array of nullable field names deliberately set to null - * - * @param boolean[] $openAPINullablesSetToNull - */ - private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void - { - $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; - } - - /** - * Checks if a property is nullable - * - * @param string $property - * @return bool - */ - public static function isNullable(string $property): bool - { - return self::openAPINullables()[$property] ?? false; - } - - /** - * Checks if a nullable property is set to null. - * - * @param string $property - * @return bool - */ - public function isNullableSetToNull(string $property): bool - { - return in_array($property, $this->getOpenAPINullablesSetToNull(), true); - } - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @var string[] - */ - protected static $attributeMap = [ - 'admin' => 'admin', - 'login' => 'login', - 'name' => 'name' - ]; - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @var string[] - */ - protected static $setters = [ - 'admin' => 'setAdmin', - 'login' => 'setLogin', - 'name' => 'setName' - ]; - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @var string[] - */ - protected static $getters = [ - 'admin' => 'getAdmin', - 'login' => 'getLogin', - 'name' => 'getName' - ]; - - /** - * Array of attributes where the key is the local name, - * and the value is the original name - * - * @return array - */ - public static function attributeMap() - { - return self::$attributeMap; - } - - /** - * Array of attributes to setter functions (for deserialization of responses) - * - * @return array - */ - public static function setters() - { - return self::$setters; - } - - /** - * Array of attributes to getter functions (for serialization of requests) - * - * @return array - */ - public static function getters() - { - return self::$getters; - } - - /** - * The original name of the model. - * - * @return string - */ - public function getModelName() - { - return self::$openAPIModelName; - } - - - /** - * Associative array for storing property values - * - * @var mixed[] - */ - protected $container = []; - - /** - * Constructor - * - * @param mixed[] $data Associated array of property values - * initializing the model - */ - public function __construct(array $data = null) - { - $this->setIfExists('admin', $data ?? [], null); - $this->setIfExists('login', $data ?? [], null); - $this->setIfExists('name', $data ?? [], null); - } - - /** - * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName - * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the - * $this->openAPINullablesSetToNull array - * - * @param string $variableName - * @param array $fields - * @param mixed $defaultValue - */ - private function setIfExists(string $variableName, array $fields, $defaultValue): void - { - if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { - $this->openAPINullablesSetToNull[] = $variableName; - } - - $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; - } - - /** - * Show all the invalid properties with reasons. - * - * @return array invalid properties with reasons - */ - public function listInvalidProperties() - { - $invalidProperties = []; - - if ($this->container['admin'] === null) { - $invalidProperties[] = "'admin' can't be null"; - } - if ($this->container['login'] === null) { - $invalidProperties[] = "'login' can't be null"; - } - if ($this->container['name'] === null) { - $invalidProperties[] = "'name' can't be null"; - } - return $invalidProperties; - } - - /** - * Validate all the properties in the model - * return true if all passed - * - * @return bool True if all properties are valid - */ - public function valid() - { - return count($this->listInvalidProperties()) === 0; - } - - - /** - * Gets admin - * - * @return bool - */ - public function getAdmin() - { - return $this->container['admin']; - } - - /** - * Sets admin - * - * @param bool $admin admin - * - * @return self - */ - public function setAdmin($admin) - { - if (is_null($admin)) { - throw new \InvalidArgumentException('non-nullable admin cannot be null'); - } - $this->container['admin'] = $admin; - - return $this; - } - - /** - * Gets login - * - * @return bool - */ - public function getLogin() - { - return $this->container['login']; - } - - /** - * Sets login - * - * @param bool $login login - * - * @return self - */ - public function setLogin($login) - { - if (is_null($login)) { - throw new \InvalidArgumentException('non-nullable login cannot be null'); - } - $this->container['login'] = $login; - - return $this; - } - - /** - * Gets name - * - * @return string - */ - public function getName() - { - return $this->container['name']; - } - - /** - * Sets name - * - * @param string $name name - * - * @return self - */ - public function setName($name) - { - if (is_null($name)) { - throw new \InvalidArgumentException('non-nullable name cannot be null'); - } - $this->container['name'] = $name; - - return $this; - } - /** - * Returns true if offset exists. False otherwise. - * - * @param integer $offset Offset - * - * @return boolean - */ - public function offsetExists($offset): bool - { - return isset($this->container[$offset]); - } - - /** - * Gets offset. - * - * @param integer $offset Offset - * - * @return mixed|null - */ - #[\ReturnTypeWillChange] - public function offsetGet($offset) - { - return $this->container[$offset] ?? null; - } - - /** - * Sets value based on offset. - * - * @param int|null $offset Offset - * @param mixed $value Value to be set - * - * @return void - */ - public function offsetSet($offset, $value): void - { - if (is_null($offset)) { - $this->container[] = $value; - } else { - $this->container[$offset] = $value; - } - } - - /** - * Unsets offset. - * - * @param integer $offset Offset - * - * @return void - */ - public function offsetUnset($offset): void - { - unset($this->container[$offset]); - } - - /** - * Serializes the object to a value that can be serialized natively by json_encode(). - * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php - * - * @return mixed Returns data which can be serialized by json_encode(), which is a value - * of any type other than a resource. - */ - #[\ReturnTypeWillChange] - public function jsonSerialize() - { - return ObjectSerializer::sanitizeForSerialization($this); - } - - /** - * Gets the string presentation of the object - * - * @return string - */ - public function __toString() - { - return json_encode( - ObjectSerializer::sanitizeForSerialization($this), - JSON_PRETTY_PRINT - ); - } - - /** - * Gets a header-safe presentation of the object - * - * @return string - */ - public function toHeaderValue() - { - return json_encode(ObjectSerializer::sanitizeForSerialization($this)); - } -} - - diff --git a/agdb_api/php/lib/ObjectSerializer.php b/agdb_api/php/lib/ObjectSerializer.php deleted file mode 100644 index ef532a57..00000000 --- a/agdb_api/php/lib/ObjectSerializer.php +++ /dev/null @@ -1,617 +0,0 @@ -format('Y-m-d') : $data->format(self::$dateTimeFormat); - } - - if (is_array($data)) { - foreach ($data as $property => $value) { - $data[$property] = self::sanitizeForSerialization($value); - } - return $data; - } - - if (is_object($data)) { - $values = []; - if ($data instanceof ModelInterface) { - $formats = $data::openAPIFormats(); - foreach ($data::openAPITypes() as $property => $openAPIType) { - $getter = $data::getters()[$property]; - $value = $data->$getter(); - if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - $callable = [$openAPIType, 'getAllowableEnumValues']; - if (is_callable($callable)) { - /** array $callable */ - $allowedEnumTypes = $callable(); - if (!in_array($value, $allowedEnumTypes, true)) { - $imploded = implode("', '", $allowedEnumTypes); - throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); - } - } - } - if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { - $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); - } - } - } else { - foreach($data as $property => $value) { - $values[$property] = self::sanitizeForSerialization($value); - } - } - return (object)$values; - } else { - return (string)$data; - } - } - - /** - * Sanitize filename by removing path. - * e.g. ../../sun.gif becomes sun.gif - * - * @param string $filename filename to be sanitized - * - * @return string the sanitized filename - */ - public static function sanitizeFilename($filename) - { - if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { - return $match[1]; - } else { - return $filename; - } - } - - /** - * Shorter timestamp microseconds to 6 digits length. - * - * @param string $timestamp Original timestamp - * - * @return string the shorten timestamp - */ - public static function sanitizeTimestamp($timestamp) - { - if (!is_string($timestamp)) return $timestamp; - - return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the path, by url-encoding. - * - * @param string $value a string which will be part of the path - * - * @return string the serialized object - */ - public static function toPathValue($value) - { - return rawurlencode(self::toString($value)); - } - - /** - * Checks if a value is empty, based on its OpenAPI type. - * - * @param mixed $value - * @param string $openApiType - * - * @return bool true if $value is empty - */ - private static function isEmptyValue($value, string $openApiType): bool - { - # If empty() returns false, it is not empty regardless of its type. - if (!empty($value)) { - return false; - } - - # Null is always empty, as we cannot send a real "null" value in a query parameter. - if ($value === null) { - return true; - } - - switch ($openApiType) { - # For numeric values, false and '' are considered empty. - # This comparison is safe for floating point values, since the previous call to empty() will - # filter out values that don't match 0. - case 'int': - case 'integer': - return $value !== 0; - - case 'number': - case 'float': - return $value !== 0 && $value !== 0.0; - - # For boolean values, '' is considered empty - case 'bool': - case 'boolean': - return !in_array($value, [false, 0], true); - - # For string values, '' is considered empty. - case 'string': - return $value === ''; - - # For all the other types, any value at this point can be considered empty. - default: - return true; - } - } - - /** - * Take query parameter properties and turn it into an array suitable for - * native http_build_query or GuzzleHttp\Psr7\Query::build. - * - * @param mixed $value Parameter value - * @param string $paramName Parameter name - * @param string $openApiType OpenAPIType eg. array or object - * @param string $style Parameter serialization style - * @param bool $explode Parameter explode option - * @param bool $required Whether query param is required or not - * - * @return array - */ - public static function toQueryValue( - $value, - string $paramName, - string $openApiType = 'string', - string $style = 'form', - bool $explode = true, - bool $required = true - ): array { - - # Check if we should omit this parameter from the query. This should only happen when: - # - Parameter is NOT required; AND - # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For - # example, 0 as "int" or "boolean" is NOT an empty value. - if (self::isEmptyValue($value, $openApiType)) { - if ($required) { - return ["{$paramName}" => '']; - } else { - return []; - } - } - - # Handle DateTime objects in query - if($openApiType === "\\DateTime" && $value instanceof \DateTime) { - return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; - } - - $query = []; - $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; - - // since \GuzzleHttp\Psr7\Query::build fails with nested arrays - // need to flatten array first - $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { - if (!is_array($arr)) return $arr; - - foreach ($arr as $k => $v) { - $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; - - if (is_array($v)) { - $flattenArray($v, $prop, $result); - } else { - if ($style !== 'deepObject' && !$explode) { - // push key itself - $result[] = $prop; - } - $result[$prop] = $v; - } - } - return $result; - }; - - $value = $flattenArray($value, $paramName); - - // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values - if ($openApiType === 'array' && $style === 'deepObject' && $explode) { - return $value; - } - - if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { - return $value; - } - - if ('boolean' === $openApiType && is_bool($value)) { - $value = self::convertBoolToQueryStringFormat($value); - } - - // handle style in serializeCollection - $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); - - return $query; - } - - /** - * Convert boolean value to format for query string. - * - * @param bool $value Boolean value - * - * @return int|string Boolean value in format - */ - public static function convertBoolToQueryStringFormat(bool $value) - { - if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { - return $value ? 'true' : 'false'; - } - - return (int) $value; - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the header. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string $value a string which will be part of the header - * - * @return string the header string - */ - public static function toHeaderValue($value) - { - $callable = [$value, 'toHeaderValue']; - if (is_callable($callable)) { - return $callable(); - } - - return self::toString($value); - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the http body (form parameter). If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * - * @param string|\SplFileObject $value the value of the form parameter - * - * @return string the form string - */ - public static function toFormValue($value) - { - if ($value instanceof \SplFileObject) { - return $value->getRealPath(); - } else { - return self::toString($value); - } - } - - /** - * Take value and turn it into a string suitable for inclusion in - * the parameter. If it's a string, pass through unchanged - * If it's a datetime object, format it in ISO8601 - * If it's a boolean, convert it to "true" or "false". - * - * @param float|int|bool|\DateTime $value the value of the parameter - * - * @return string the header string - */ - public static function toString($value) - { - if ($value instanceof \DateTime) { // datetime in ISO8601 format - return $value->format(self::$dateTimeFormat); - } elseif (is_bool($value)) { - return $value ? 'true' : 'false'; - } else { - return (string) $value; - } - } - - /** - * Serialize an array to a string. - * - * @param array $collection collection to serialize to a string - * @param string $style the format use for serialization (csv, - * ssv, tsv, pipes, multi) - * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array - * - * @return string - */ - public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) - { - if ($allowCollectionFormatMulti && ('multi' === $style)) { - // http_build_query() almost does the job for us. We just - // need to fix the result of multidimensional arrays. - return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); - } - switch ($style) { - case 'pipeDelimited': - case 'pipes': - return implode('|', $collection); - - case 'tsv': - return implode("\t", $collection); - - case 'spaceDelimited': - case 'ssv': - return implode(' ', $collection); - - case 'simple': - case 'csv': - // Deliberate fall through. CSV is default format. - default: - return implode(',', $collection); - } - } - - /** - * Deserialize a JSON string into an object - * - * @param mixed $data object or primitive to be deserialized - * @param string $class class name is passed as a string - * @param string[] $httpHeaders HTTP headers - * - * @return object|array|null a single or an array of $class instances - */ - public static function deserialize($data, $class, $httpHeaders = null) - { - if (null === $data) { - return null; - } - - if (strcasecmp(substr($class, -2), '[]') === 0) { - $data = is_string($data) ? json_decode($data) : $data; - - if (!is_array($data)) { - throw new \InvalidArgumentException("Invalid array '$class'"); - } - - $subClass = substr($class, 0, -2); - $values = []; - foreach ($data as $key => $value) { - $values[] = self::deserialize($value, $subClass, null); - } - return $values; - } - - if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array - $data = is_string($data) ? json_decode($data) : $data; - settype($data, 'array'); - $inner = substr($class, 4, -1); - $deserialized = []; - if (strrpos($inner, ",") !== false) { - $subClass_array = explode(',', $inner, 2); - $subClass = $subClass_array[1]; - foreach ($data as $key => $value) { - $deserialized[$key] = self::deserialize($value, $subClass, null); - } - } - return $deserialized; - } - - if ($class === 'object') { - settype($data, 'array'); - return $data; - } elseif ($class === 'mixed') { - settype($data, gettype($data)); - return $data; - } - - if ($class === '\DateTime') { - // Some APIs return an invalid, empty string as a - // date-time property. DateTime::__construct() will return - // the current time for empty input which is probably not - // what is meant. The invalid empty string is probably to - // be interpreted as a missing field/value. Let's handle - // this graceful. - if (!empty($data)) { - try { - return new \DateTime($data); - } catch (\Exception $exception) { - // Some APIs return a date-time with too high nanosecond - // precision for php's DateTime to handle. - // With provided regexp 6 digits of microseconds saved - return new \DateTime(self::sanitizeTimestamp($data)); - } - } else { - return null; - } - } - - if ($class === '\SplFileObject') { - $data = Utils::streamFor($data); - - /** @var \Psr\Http\Message\StreamInterface $data */ - - // determine file name - if ( - is_array($httpHeaders) - && array_key_exists('Content-Disposition', $httpHeaders) - && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) - ) { - $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); - } else { - $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); - } - - $file = fopen($filename, 'w'); - while ($chunk = $data->read(200)) { - fwrite($file, $chunk); - } - fclose($file); - - return new \SplFileObject($filename, 'r'); - } - - /** @psalm-suppress ParadoxicalCondition */ - if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { - settype($data, $class); - return $data; - } - - - if (method_exists($class, 'getAllowableEnumValues')) { - if (!in_array($data, $class::getAllowableEnumValues(), true)) { - $imploded = implode("', '", $class::getAllowableEnumValues()); - throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); - } - return $data; - } else { - $data = is_string($data) ? json_decode($data) : $data; - - if (is_array($data)) { - $data = (object)$data; - } - - // If a discriminator is defined and points to a valid subclass, use it. - $discriminator = $class::DISCRIMINATOR; - if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { - $subclass = '\Agnesoft\AgdbApi\Model\\' . $data->{$discriminator}; - if (is_subclass_of($subclass, $class)) { - $class = $subclass; - } - } - - /** @var ModelInterface $instance */ - $instance = new $class(); - foreach ($instance::openAPITypes() as $property => $type) { - $propertySetter = $instance::setters()[$property]; - - if (!isset($propertySetter)) { - continue; - } - - if (!isset($data->{$instance::attributeMap()[$property]})) { - if ($instance::isNullable($property)) { - $instance->$propertySetter(null); - } - - continue; - } - - if (isset($data->{$instance::attributeMap()[$property]})) { - $propertyValue = $data->{$instance::attributeMap()[$property]}; - $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); - } - } - return $instance; - } - } - - /** - * Build a query string from an array of key value pairs. - * - * This function can use the return value of `parse()` to build a query - * string. This function does not modify the provided keys when an array is - * encountered (like `http_build_query()` would). - * - * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 - * with a modification which is described in https://github.com/guzzle/psr7/pull/603 - * - * @param array $params Query string parameters. - * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 - * to encode using RFC3986, or PHP_QUERY_RFC1738 - * to encode using RFC1738. - */ - public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string - { - if (!$params) { - return ''; - } - - if ($encoding === false) { - $encoder = function (string $str): string { - return $str; - }; - } elseif ($encoding === PHP_QUERY_RFC3986) { - $encoder = 'rawurlencode'; - } elseif ($encoding === PHP_QUERY_RFC1738) { - $encoder = 'urlencode'; - } else { - throw new \InvalidArgumentException('Invalid type'); - } - - $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() - ? function ($v) { return (int) $v; } - : function ($v) { return $v ? 'true' : 'false'; }; - - $qs = ''; - foreach ($params as $k => $v) { - $k = $encoder((string) $k); - if (!is_array($v)) { - $qs .= $k; - $v = is_bool($v) ? $castBool($v) : $v; - if ($v !== null) { - $qs .= '='.$encoder((string) $v); - } - $qs .= '&'; - } else { - foreach ($v as $vv) { - $qs .= $k; - $vv = is_bool($vv) ? $castBool($vv) : $vv; - if ($vv !== null) { - $qs .= '='.$encoder((string) $vv); - } - $qs .= '&'; - } - } - } - - return $qs ? (string) substr($qs, 0, -1) : ''; - } -} diff --git a/agdb_api/typescript/src/openapi.d.ts b/agdb_api/typescript/src/openapi.d.ts index 233a3ccf..a5a636ac 100644 --- a/agdb_api/typescript/src/openapi.d.ts +++ b/agdb_api/typescript/src/openapi.d.ts @@ -2003,6 +2003,14 @@ export interface OperationMethods { data?: any, config?: AxiosRequestConfig ): OperationResponse + /** + * db_clear + */ + 'db_clear'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse /** * admin_db_convert */ @@ -2366,6 +2374,16 @@ export interface PathsDictionary { config?: AxiosRequestConfig ): OperationResponse } + ['/api/v1/admin/db/{owner}/{db}/clear']: { + /** + * db_clear + */ + 'post'( + parameters?: Parameters | null, + data?: any, + config?: AxiosRequestConfig + ): OperationResponse + } ['/api/v1/admin/db/{owner}/{db}/convert']: { /** * admin_db_convert diff --git a/agdb_server/src/config.rs b/agdb_server/src/config.rs index 4181608b..6c842420 100644 --- a/agdb_server/src/config.rs +++ b/agdb_server/src/config.rs @@ -12,9 +12,10 @@ pub(crate) type Config = Arc; const CONFIG_FILE: &str = "agdb_server.yaml"; +#[derive(Debug)] pub(crate) struct LogLevel(pub(crate) LevelFilter); -#[derive(Deserialize, Serialize)] +#[derive(Debug, Deserialize, Serialize)] pub(crate) struct ConfigImpl { pub(crate) bind: String, pub(crate) address: Url, @@ -43,7 +44,7 @@ pub(crate) fn new() -> ServerResult { if !config.cluster.is_empty() && !config.cluster.contains(&config.address) { return Err(ServerError::from(format!( - "Cluster does not contain this node: {}", + "Cluster does not contain local node: {}", config.address ))); } @@ -133,6 +134,28 @@ mod tests { let _config = config::new().unwrap(); } + #[test] + fn invalid_cluster() { + let _test_file = TestFile::new(); + let config = ConfigImpl { + bind: ":::3000".to_string(), + address: Url::parse("localhost:3000").unwrap(), + basepath: "".to_string(), + admin: "admin".to_string(), + log_level: LogLevel(LevelFilter::INFO), + data_dir: "agdb_server_data".to_string(), + cluster_token: "cluster".to_string(), + cluster: vec![Url::parse("localhost:3001").unwrap()], + cluster_node_id: 0, + start_time: 0, + }; + std::fs::write(CONFIG_FILE, serde_yaml::to_string(&config).unwrap()).unwrap(); + assert_eq!( + config::new().unwrap_err().description, + "Cluster does not contain local node: localhost:3000" + ); + } + #[test] fn log_level() { let level = LogLevel(LevelFilter::OFF); @@ -164,5 +187,13 @@ mod tests { let serialized = serde_yaml::to_string(&level).unwrap(); let other: LogLevel = serde_yaml::from_str(&serialized).unwrap(); assert_eq!(level.0, other.0); + + let serialized = "INVALID".to_string(); + assert_eq!( + serde_yaml::from_str::(&serialized) + .unwrap_err() + .to_string(), + "Invalid log level" + ); } } diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 1bc790d5..40839a75 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -7,6 +7,7 @@ use crate::server_db::Database; use crate::server_db::ServerDb; use crate::server_error::ServerError; use crate::server_error::ServerResult; +use crate::utilities::remove_file_if_exists; use agdb::QueryResult; use agdb_api::DbAudit; use agdb_api::DbResource; @@ -74,7 +75,7 @@ impl DbPool { e })?; - let backup = if db_backup_file(owner, db, config).exists() { + let backup = if std::fs::exists(db_backup_file(owner, db, config))? { SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs() } else { 0 @@ -117,11 +118,8 @@ impl DbPool { db_backup_file(owner, db, config) }; - if backup_path.exists() { - std::fs::remove_file(&backup_path)?; - } else { - std::fs::create_dir_all(db_backup_dir(owner, config))?; - } + remove_file_if_exists(&backup_path)?; + std::fs::create_dir_all(db_backup_dir(owner, config))?; user_db .backup(backup_path.to_string_lossy().as_ref()) @@ -142,14 +140,14 @@ impl DbPool { match resource { DbResource::All => { self.do_clear_db(owner, db, database, config).await?; - do_clear_db_audit(owner, db, config)?; + remove_file_if_exists(db_audit_file(owner, db, config))?; self.do_clear_db_backup(owner, db, config, database).await?; } DbResource::Db => { self.do_clear_db(owner, db, database, config).await?; } DbResource::Audit => { - do_clear_db_audit(owner, db, config)?; + remove_file_if_exists(db_audit_file(owner, db, config))?; } DbResource::Backup => { self.do_clear_db_backup(owner, db, config, database).await?; @@ -190,9 +188,7 @@ impl DbPool { } else { db_backup_file(owner, db, config) }; - if backup_file.exists() { - std::fs::remove_file(&backup_file)?; - } + remove_file_if_exists(&backup_file)?; database.backup = 0; Ok(()) } @@ -210,16 +206,8 @@ impl DbPool { .ok_or(db_not_found(&database.name))?; *user_db = UserDb::new(&format!("{}:{}", DbType::Memory, &database.name))?; if database.db_type != DbType::Memory { - let main_file = db_file(owner, db, config); - if main_file.exists() { - std::fs::remove_file(&main_file)?; - } - - let wal_file = db_file(owner, &format!(".{db}"), config); - if wal_file.exists() { - std::fs::remove_file(wal_file)?; - } - + remove_file_if_exists(db_file(owner, db, config))?; + remove_file_if_exists(db_file(owner, &format!(".{db}"), config))?; let db_path = Path::new(&config.data_dir).join(&database.name); let path = db_path.to_str().ok_or(ErrorCode::DbInvalid)?.to_string(); *user_db = UserDb::new(&format!("{}:{path}", database.db_type))?; @@ -269,7 +257,7 @@ impl DbPool { ) -> ServerResult { let target_file = db_file(new_owner, new_db, config); - if target_file.exists() { + if std::fs::exists(&target_file)? { return Err(ErrorCode::DbExists.into()); } @@ -299,28 +287,10 @@ impl DbPool { config: &Config, ) -> ServerResult { self.remove_db(db_name).await?; - - let main_file = db_file(owner, db, config); - if main_file.exists() { - std::fs::remove_file(&main_file)?; - } - - let wal_file = db_file(owner, &format!(".{db}"), config); - if wal_file.exists() { - std::fs::remove_file(wal_file)?; - } - - let backup_file = db_backup_file(owner, db, config); - if backup_file.exists() { - std::fs::remove_file(backup_file)?; - } - - let audit_file = db_audit_file(owner, db, config); - if audit_file.exists() { - std::fs::remove_file(audit_file)?; - } - - Ok(()) + remove_file_if_exists(db_file(owner, db, config))?; + remove_file_if_exists(db_file(owner, &format!(".{db}"), config))?; + remove_file_if_exists(db_backup_file(owner, db, config))?; + remove_file_if_exists(db_audit_file(owner, db, config)) } pub(crate) async fn exec( @@ -382,11 +352,7 @@ impl DbPool { self.0.write().await.remove(db); } - let user_dir = Path::new(&config.data_dir).join(username); - - if user_dir.exists() { - std::fs::remove_dir_all(user_dir)?; - } + remove_file_if_exists(Path::new(&config.data_dir).join(username))?; Ok(()) } @@ -478,16 +444,6 @@ impl DbPool { } } -fn do_clear_db_audit(owner: &str, db: &str, config: &Config) -> Result<(), ServerError> { - let audit_file = db_audit_file(owner, db, config); - - if audit_file.exists() { - std::fs::remove_file(&audit_file)?; - } - - Ok(()) -} - fn db_not_found(name: &str) -> ServerError { ServerError::new(StatusCode::NOT_FOUND, &format!("db not found: {name}")) } diff --git a/agdb_server/src/utilities.rs b/agdb_server/src/utilities.rs index 0e8e517f..b09d09b8 100644 --- a/agdb_server/src/utilities.rs +++ b/agdb_server/src/utilities.rs @@ -35,6 +35,17 @@ where Ok(size_in_bytes) } +pub(crate) fn remove_file_if_exists

(file: P) -> ServerResult +where + P: AsRef, +{ + if std::fs::exists(&file)? { + std::fs::remove_file(file)?; + } + + Ok(()) +} + pub(crate) fn required_role(queries: &Queries) -> DbUserRole { for q in &queries.0 { match q { @@ -57,3 +68,15 @@ pub(crate) fn required_role(queries: &Queries) -> DbUserRole { pub(crate) fn unquote(value: &str) -> &str { value.trim_start_matches('"').trim_end_matches('"') } + +#[cfg(test)] +mod tests { + use super::*; + + #[tokio::test] + async fn get_size_on_file() -> anyhow::Result<()> { + let size = get_size("Cargo.toml").await.unwrap(); + assert_ne!(size, 0); + Ok(()) + } +} diff --git a/agdb_server/tests/cluster/cluster_test.rs b/agdb_server/tests/cluster/cluster_test.rs index 083dc784..ecbd72b9 100644 --- a/agdb_server/tests/cluster/cluster_test.rs +++ b/agdb_server/tests/cluster/cluster_test.rs @@ -141,3 +141,20 @@ async fn vote_no_token() -> anyhow::Result<()> { Ok(()) } + +#[tokio::test] +async fn wrong_token() -> anyhow::Result<()> { + let server = TestServer::new().await?; + let client = reqwest::Client::new(); + + let status = client + .get(server.full_url("/cluster/vote?cluster_hash=test&term=1&leader=0")) + .bearer_auth("WRONG") + .send() + .await? + .status(); + + assert_eq!(status, 401); + + Ok(()) +} From c95b01b97eee21420e525f3a02957134982e5776 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Nov 2024 20:08:24 +0100 Subject: [PATCH 26/28] fix coverage --- agdb_server/src/config.rs | 37 +++++++++---------- agdb_server/src/db_pool.rs | 17 ++++----- agdb_server/src/main.rs | 4 +- .../tests/routes/admin_db_convert_test.rs | 19 ++++++++++ 4 files changed, 48 insertions(+), 29 deletions(-) diff --git a/agdb_server/src/config.rs b/agdb_server/src/config.rs index 6c842420..e8c5d3cf 100644 --- a/agdb_server/src/config.rs +++ b/agdb_server/src/config.rs @@ -10,8 +10,6 @@ use url::Url; pub(crate) type Config = Arc; -const CONFIG_FILE: &str = "agdb_server.yaml"; - #[derive(Debug)] pub(crate) struct LogLevel(pub(crate) LevelFilter); @@ -31,8 +29,8 @@ pub(crate) struct ConfigImpl { pub(crate) start_time: u64, } -pub(crate) fn new() -> ServerResult { - if let Ok(content) = std::fs::read_to_string(CONFIG_FILE) { +pub(crate) fn new(config_file: &str) -> ServerResult { + if let Ok(content) = std::fs::read_to_string(config_file) { let mut config_impl: ConfigImpl = serde_yaml::from_str(&content)?; config_impl.cluster_node_id = config_impl .cluster @@ -65,7 +63,7 @@ pub(crate) fn new() -> ServerResult { start_time: SystemTime::now().duration_since(UNIX_EPOCH)?.as_secs(), }; - std::fs::write(CONFIG_FILE, serde_yaml::to_string(&config)?)?; + std::fs::write(config_file, serde_yaml::to_string(&config)?)?; Ok(Config::new(config)) } @@ -108,35 +106,36 @@ impl<'de> Deserialize<'de> for LogLevel { mod tests { use super::*; use crate::config; - use std::path::Path; - struct TestFile {} + struct TestFile { + filename: &'static str, + } impl TestFile { - fn new() -> Self { - let _ = std::fs::remove_file(CONFIG_FILE); - Self {} + fn new(filename: &'static str) -> Self { + let _ = std::fs::remove_file(filename); + Self { filename } } } impl Drop for TestFile { fn drop(&mut self) { - let _ = std::fs::remove_file(CONFIG_FILE); + let _ = std::fs::remove_file(self.filename); } } #[test] fn default_values() { - let _test_file = TestFile::new(); - assert!(!Path::new(CONFIG_FILE).exists()); - let _config = config::new().unwrap(); - assert!(Path::new(CONFIG_FILE).exists()); - let _config = config::new().unwrap(); + let test_file = TestFile::new("test_config_default.yaml"); + assert!(!std::fs::exists(test_file.filename).unwrap()); + let _config = config::new(test_file.filename).unwrap(); + assert!(std::fs::exists(test_file.filename).unwrap()); + let _config = config::new(test_file.filename).unwrap(); } #[test] fn invalid_cluster() { - let _test_file = TestFile::new(); + let test_file = TestFile::new("test_config_invalid_cluster.yaml"); let config = ConfigImpl { bind: ":::3000".to_string(), address: Url::parse("localhost:3000").unwrap(), @@ -149,9 +148,9 @@ mod tests { cluster_node_id: 0, start_time: 0, }; - std::fs::write(CONFIG_FILE, serde_yaml::to_string(&config).unwrap()).unwrap(); + std::fs::write(test_file.filename, serde_yaml::to_string(&config).unwrap()).unwrap(); assert_eq!( - config::new().unwrap_err().description, + config::new(test_file.filename).unwrap_err().description, "Cluster does not contain local node: localhost:3000" ); } diff --git a/agdb_server/src/db_pool.rs b/agdb_server/src/db_pool.rs index 40839a75..834cfc35 100644 --- a/agdb_server/src/db_pool.rs +++ b/agdb_server/src/db_pool.rs @@ -257,7 +257,9 @@ impl DbPool { ) -> ServerResult { let target_file = db_file(new_owner, new_db, config); - if std::fs::exists(&target_file)? { + if std::fs::exists(&target_file) + .map_err(|e| ServerError::new(ErrorCode::DbInvalid.into(), &e.to_string()))? + { return Err(ErrorCode::DbExists.into()); } @@ -267,13 +269,7 @@ impl DbPool { .db(source_db) .await? .copy(target_file.to_string_lossy().as_ref()) - .await - .map_err(|e| { - ServerError::new( - ErrorCode::DbInvalid.into(), - &format!("db copy error: {}", e.description), - ) - })?; + .await?; self.0.write().await.insert(target_db.to_string(), user_db); Ok(()) @@ -352,7 +348,10 @@ impl DbPool { self.0.write().await.remove(db); } - remove_file_if_exists(Path::new(&config.data_dir).join(username))?; + let user_dir = Path::new(&config.data_dir).join(username); + if std::fs::exists(&user_dir)? { + std::fs::remove_dir_all(&user_dir)?; + } Ok(()) } diff --git a/agdb_server/src/main.rs b/agdb_server/src/main.rs index 6dd7c677..683d5fa3 100644 --- a/agdb_server/src/main.rs +++ b/agdb_server/src/main.rs @@ -17,9 +17,11 @@ use crate::db_pool::DbPool; use server_error::ServerResult; use tokio::sync::broadcast; +const CONFIG_FILE: &str = "agdb_server.yaml"; + #[tokio::main] async fn main() -> ServerResult { - let config = config::new()?; + let config = config::new(CONFIG_FILE)?; tracing_subscriber::fmt() .with_max_level(config.log_level.0) .init(); diff --git a/agdb_server/tests/routes/admin_db_convert_test.rs b/agdb_server/tests/routes/admin_db_convert_test.rs index 576c2b01..332ce3c0 100644 --- a/agdb_server/tests/routes/admin_db_convert_test.rs +++ b/agdb_server/tests/routes/admin_db_convert_test.rs @@ -22,6 +22,25 @@ async fn memory_to_mapped() -> anyhow::Result<()> { Ok(()) } +#[tokio::test] +async fn same_type() -> anyhow::Result<()> { + let mut server = TestServer::new().await?; + let owner = &server.next_user_name(); + let db = &server.next_db_name(); + server.api.user_login(ADMIN, ADMIN).await?; + server.api.admin_user_add(owner, owner).await?; + server.api.admin_db_add(owner, db, DbType::Memory).await?; + let status = server + .api + .admin_db_convert(owner, db, DbType::Memory) + .await?; + assert_eq!(status, 201); + let list = server.api.db_list().await?.1; + assert_eq!(list[0].db_type, DbType::Memory); + + Ok(()) +} + #[tokio::test] async fn non_admin() -> anyhow::Result<()> { let mut server = TestServer::new().await?; From 32c01fbdd18b0dd0c0c01bae42ff444c5821f098 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Nov 2024 20:17:41 +0100 Subject: [PATCH 27/28] Update admin_db_convert_test.rs --- agdb_server/tests/routes/admin_db_convert_test.rs | 1 + 1 file changed, 1 insertion(+) diff --git a/agdb_server/tests/routes/admin_db_convert_test.rs b/agdb_server/tests/routes/admin_db_convert_test.rs index 332ce3c0..77602555 100644 --- a/agdb_server/tests/routes/admin_db_convert_test.rs +++ b/agdb_server/tests/routes/admin_db_convert_test.rs @@ -35,6 +35,7 @@ async fn same_type() -> anyhow::Result<()> { .admin_db_convert(owner, db, DbType::Memory) .await?; assert_eq!(status, 201); + server.api.user_login(owner, owner).await?; let list = server.api.db_list().await?.1; assert_eq!(list[0].db_type, DbType::Memory); From a901b1dd450e9a0ed38f4a80b5072d47388ba6d5 Mon Sep 17 00:00:00 2001 From: Michael Vlach Date: Wed, 13 Nov 2024 20:22:30 +0100 Subject: [PATCH 28/28] update php api --- agdb_api/php/README.md | 1 + agdb_api/php/docs/Api/AgdbApi.md | 2696 ++++ agdb_api/php/docs/Model/AdminStatus.md | 13 + agdb_api/php/docs/Model/ChangePassword.md | 10 + agdb_api/php/docs/Model/ClusterStatus.md | 13 + agdb_api/php/docs/Model/Comparison.md | 15 + agdb_api/php/docs/Model/ComparisonOneOf.md | 9 + agdb_api/php/docs/Model/ComparisonOneOf1.md | 9 + agdb_api/php/docs/Model/ComparisonOneOf2.md | 9 + agdb_api/php/docs/Model/ComparisonOneOf3.md | 9 + agdb_api/php/docs/Model/ComparisonOneOf4.md | 9 + agdb_api/php/docs/Model/ComparisonOneOf5.md | 9 + agdb_api/php/docs/Model/ComparisonOneOf6.md | 9 + agdb_api/php/docs/Model/CountComparison.md | 14 + .../php/docs/Model/CountComparisonOneOf.md | 9 + .../php/docs/Model/CountComparisonOneOf1.md | 9 + .../php/docs/Model/CountComparisonOneOf2.md | 9 + .../php/docs/Model/CountComparisonOneOf3.md | 9 + .../php/docs/Model/CountComparisonOneOf4.md | 9 + .../php/docs/Model/CountComparisonOneOf5.md | 9 + agdb_api/php/docs/Model/DbElement.md | 12 + agdb_api/php/docs/Model/DbKeyOrder.md | 10 + agdb_api/php/docs/Model/DbKeyOrderOneOf.md | 9 + agdb_api/php/docs/Model/DbKeyOrderOneOf1.md | 9 + agdb_api/php/docs/Model/DbKeyValue.md | 10 + agdb_api/php/docs/Model/DbResource.md | 8 + agdb_api/php/docs/Model/DbType.md | 8 + agdb_api/php/docs/Model/DbTypeParam.md | 9 + agdb_api/php/docs/Model/DbUser.md | 10 + agdb_api/php/docs/Model/DbUserRole.md | 8 + agdb_api/php/docs/Model/DbUserRoleParam.md | 9 + agdb_api/php/docs/Model/DbValue.md | 17 + agdb_api/php/docs/Model/DbValueOneOf.md | 9 + agdb_api/php/docs/Model/DbValueOneOf1.md | 9 + agdb_api/php/docs/Model/DbValueOneOf2.md | 9 + agdb_api/php/docs/Model/DbValueOneOf3.md | 9 + agdb_api/php/docs/Model/DbValueOneOf4.md | 9 + agdb_api/php/docs/Model/DbValueOneOf5.md | 9 + agdb_api/php/docs/Model/DbValueOneOf6.md | 9 + agdb_api/php/docs/Model/DbValueOneOf7.md | 9 + agdb_api/php/docs/Model/DbValueOneOf8.md | 9 + agdb_api/php/docs/Model/InsertAliasesQuery.md | 10 + agdb_api/php/docs/Model/InsertEdgesQuery.md | 13 + agdb_api/php/docs/Model/InsertNodesQuery.md | 12 + agdb_api/php/docs/Model/InsertValuesQuery.md | 10 + agdb_api/php/docs/Model/QueryAudit.md | 11 + agdb_api/php/docs/Model/QueryCondition.md | 11 + agdb_api/php/docs/Model/QueryConditionData.md | 16 + .../php/docs/Model/QueryConditionDataOneOf.md | 9 + .../docs/Model/QueryConditionDataOneOf1.md | 9 + .../docs/Model/QueryConditionDataOneOf2.md | 9 + .../docs/Model/QueryConditionDataOneOf3.md | 9 + .../docs/Model/QueryConditionDataOneOf4.md | 9 + .../docs/Model/QueryConditionDataOneOf5.md | 9 + .../Model/QueryConditionDataOneOf5KeyValue.md | 10 + .../docs/Model/QueryConditionDataOneOf6.md | 9 + .../docs/Model/QueryConditionDataOneOf7.md | 9 + .../php/docs/Model/QueryConditionLogic.md | 8 + .../php/docs/Model/QueryConditionModifier.md | 8 + agdb_api/php/docs/Model/QueryId.md | 10 + agdb_api/php/docs/Model/QueryIdOneOf.md | 9 + agdb_api/php/docs/Model/QueryIdOneOf1.md | 9 + agdb_api/php/docs/Model/QueryIds.md | 10 + agdb_api/php/docs/Model/QueryIdsOneOf.md | 9 + agdb_api/php/docs/Model/QueryIdsOneOf1.md | 9 + agdb_api/php/docs/Model/QueryResult.md | 10 + agdb_api/php/docs/Model/QueryType.md | 26 + agdb_api/php/docs/Model/QueryTypeOneOf.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf1.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf10.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf11.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf12.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf13.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf14.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf15.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf16.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf2.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf3.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf4.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf5.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf6.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf7.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf8.md | 9 + agdb_api/php/docs/Model/QueryTypeOneOf9.md | 9 + agdb_api/php/docs/Model/QueryValues.md | 10 + agdb_api/php/docs/Model/QueryValuesOneOf.md | 9 + agdb_api/php/docs/Model/QueryValuesOneOf1.md | 9 + agdb_api/php/docs/Model/SearchQuery.md | 15 + .../php/docs/Model/SearchQueryAlgorithm.md | 8 + .../php/docs/Model/SelectEdgeCountQuery.md | 11 + agdb_api/php/docs/Model/SelectValuesQuery.md | 10 + agdb_api/php/docs/Model/ServerDatabase.md | 13 + .../php/docs/Model/ServerDatabaseRename.md | 9 + .../php/docs/Model/ServerDatabaseResource.md | 9 + agdb_api/php/docs/Model/UserCredentials.md | 9 + agdb_api/php/docs/Model/UserLogin.md | 10 + agdb_api/php/docs/Model/UserStatus.md | 11 + agdb_api/php/lib/Api/AgdbApi.php | 12312 ++++++++++++++++ agdb_api/php/lib/ApiException.php | 119 + agdb_api/php/lib/Configuration.php | 532 + agdb_api/php/lib/HeaderSelector.php | 273 + agdb_api/php/lib/Model/AdminStatus.php | 605 + agdb_api/php/lib/Model/ChangePassword.php | 449 + agdb_api/php/lib/Model/ClusterStatus.php | 578 + agdb_api/php/lib/Model/Comparison.php | 635 + agdb_api/php/lib/Model/ComparisonOneOf.php | 412 + agdb_api/php/lib/Model/ComparisonOneOf1.php | 412 + agdb_api/php/lib/Model/ComparisonOneOf2.php | 412 + agdb_api/php/lib/Model/ComparisonOneOf3.php | 412 + agdb_api/php/lib/Model/ComparisonOneOf4.php | 412 + agdb_api/php/lib/Model/ComparisonOneOf5.php | 412 + agdb_api/php/lib/Model/ComparisonOneOf6.php | 412 + agdb_api/php/lib/Model/CountComparison.php | 652 + .../php/lib/Model/CountComparisonOneOf.php | 421 + .../php/lib/Model/CountComparisonOneOf1.php | 421 + .../php/lib/Model/CountComparisonOneOf2.php | 421 + .../php/lib/Model/CountComparisonOneOf3.php | 421 + .../php/lib/Model/CountComparisonOneOf4.php | 421 + .../php/lib/Model/CountComparisonOneOf5.php | 421 + agdb_api/php/lib/Model/DbElement.php | 532 + agdb_api/php/lib/Model/DbKeyOrder.php | 450 + agdb_api/php/lib/Model/DbKeyOrderOneOf.php | 412 + agdb_api/php/lib/Model/DbKeyOrderOneOf1.php | 412 + agdb_api/php/lib/Model/DbKeyValue.php | 450 + agdb_api/php/lib/Model/DbResource.php | 68 + agdb_api/php/lib/Model/DbType.php | 65 + agdb_api/php/lib/Model/DbTypeParam.php | 412 + agdb_api/php/lib/Model/DbUser.php | 449 + agdb_api/php/lib/Model/DbUserRole.php | 65 + agdb_api/php/lib/Model/DbUserRoleParam.php | 412 + agdb_api/php/lib/Model/DbValue.php | 718 + agdb_api/php/lib/Model/DbValueOneOf.php | 412 + agdb_api/php/lib/Model/DbValueOneOf1.php | 412 + agdb_api/php/lib/Model/DbValueOneOf2.php | 421 + agdb_api/php/lib/Model/DbValueOneOf3.php | 412 + agdb_api/php/lib/Model/DbValueOneOf4.php | 412 + agdb_api/php/lib/Model/DbValueOneOf5.php | 412 + agdb_api/php/lib/Model/DbValueOneOf6.php | 412 + agdb_api/php/lib/Model/DbValueOneOf7.php | 412 + agdb_api/php/lib/Model/DbValueOneOf8.php | 412 + agdb_api/php/lib/Model/InsertAliasesQuery.php | 450 + agdb_api/php/lib/Model/InsertEdgesQuery.php | 561 + agdb_api/php/lib/Model/InsertNodesQuery.php | 533 + agdb_api/php/lib/Model/InsertValuesQuery.php | 450 + agdb_api/php/lib/Model/ModelInterface.php | 111 + agdb_api/php/lib/Model/QueryAudit.php | 495 + agdb_api/php/lib/Model/QueryCondition.php | 487 + agdb_api/php/lib/Model/QueryConditionData.php | 672 + .../php/lib/Model/QueryConditionDataOneOf.php | 412 + .../lib/Model/QueryConditionDataOneOf1.php | 412 + .../lib/Model/QueryConditionDataOneOf2.php | 412 + .../lib/Model/QueryConditionDataOneOf3.php | 412 + .../lib/Model/QueryConditionDataOneOf4.php | 412 + .../lib/Model/QueryConditionDataOneOf5.php | 412 + .../QueryConditionDataOneOf5KeyValue.php | 450 + .../lib/Model/QueryConditionDataOneOf6.php | 412 + .../lib/Model/QueryConditionDataOneOf7.php | 412 + .../php/lib/Model/QueryConditionLogic.php | 63 + .../php/lib/Model/QueryConditionModifier.php | 69 + agdb_api/php/lib/Model/QueryId.php | 450 + agdb_api/php/lib/Model/QueryIdOneOf.php | 412 + agdb_api/php/lib/Model/QueryIdOneOf1.php | 412 + agdb_api/php/lib/Model/QueryIds.php | 450 + agdb_api/php/lib/Model/QueryIdsOneOf.php | 412 + agdb_api/php/lib/Model/QueryIdsOneOf1.php | 412 + agdb_api/php/lib/Model/QueryResult.php | 450 + agdb_api/php/lib/Model/QueryType.php | 1042 ++ agdb_api/php/lib/Model/QueryTypeOneOf.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf1.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf10.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf11.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf12.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf13.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf14.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf15.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf16.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf2.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf3.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf4.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf5.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf6.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf7.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf8.php | 412 + agdb_api/php/lib/Model/QueryTypeOneOf9.php | 412 + agdb_api/php/lib/Model/QueryValues.php | 450 + agdb_api/php/lib/Model/QueryValuesOneOf.php | 412 + agdb_api/php/lib/Model/QueryValuesOneOf1.php | 412 + agdb_api/php/lib/Model/SearchQuery.php | 653 + .../php/lib/Model/SearchQueryAlgorithm.php | 69 + .../php/lib/Model/SelectEdgeCountQuery.php | 487 + agdb_api/php/lib/Model/SelectValuesQuery.php | 450 + agdb_api/php/lib/Model/ServerDatabase.php | 578 + .../php/lib/Model/ServerDatabaseRename.php | 412 + .../php/lib/Model/ServerDatabaseResource.php | 412 + agdb_api/php/lib/Model/UserCredentials.php | 412 + agdb_api/php/lib/Model/UserLogin.php | 449 + agdb_api/php/lib/Model/UserStatus.php | 486 + agdb_api/php/lib/ObjectSerializer.php | 617 + agdb_api/typescript/src/openapi.d.ts | 35 +- agdb_server/openapi.json | 5 +- agdb_server/src/routes/admin/db.rs | 3 +- 201 files changed, 58375 insertions(+), 13 deletions(-) create mode 100644 agdb_api/php/docs/Api/AgdbApi.md create mode 100644 agdb_api/php/docs/Model/AdminStatus.md create mode 100644 agdb_api/php/docs/Model/ChangePassword.md create mode 100644 agdb_api/php/docs/Model/ClusterStatus.md create mode 100644 agdb_api/php/docs/Model/Comparison.md create mode 100644 agdb_api/php/docs/Model/ComparisonOneOf.md create mode 100644 agdb_api/php/docs/Model/ComparisonOneOf1.md create mode 100644 agdb_api/php/docs/Model/ComparisonOneOf2.md create mode 100644 agdb_api/php/docs/Model/ComparisonOneOf3.md create mode 100644 agdb_api/php/docs/Model/ComparisonOneOf4.md create mode 100644 agdb_api/php/docs/Model/ComparisonOneOf5.md create mode 100644 agdb_api/php/docs/Model/ComparisonOneOf6.md create mode 100644 agdb_api/php/docs/Model/CountComparison.md create mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf.md create mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf1.md create mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf2.md create mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf3.md create mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf4.md create mode 100644 agdb_api/php/docs/Model/CountComparisonOneOf5.md create mode 100644 agdb_api/php/docs/Model/DbElement.md create mode 100644 agdb_api/php/docs/Model/DbKeyOrder.md create mode 100644 agdb_api/php/docs/Model/DbKeyOrderOneOf.md create mode 100644 agdb_api/php/docs/Model/DbKeyOrderOneOf1.md create mode 100644 agdb_api/php/docs/Model/DbKeyValue.md create mode 100644 agdb_api/php/docs/Model/DbResource.md create mode 100644 agdb_api/php/docs/Model/DbType.md create mode 100644 agdb_api/php/docs/Model/DbTypeParam.md create mode 100644 agdb_api/php/docs/Model/DbUser.md create mode 100644 agdb_api/php/docs/Model/DbUserRole.md create mode 100644 agdb_api/php/docs/Model/DbUserRoleParam.md create mode 100644 agdb_api/php/docs/Model/DbValue.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf1.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf2.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf3.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf4.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf5.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf6.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf7.md create mode 100644 agdb_api/php/docs/Model/DbValueOneOf8.md create mode 100644 agdb_api/php/docs/Model/InsertAliasesQuery.md create mode 100644 agdb_api/php/docs/Model/InsertEdgesQuery.md create mode 100644 agdb_api/php/docs/Model/InsertNodesQuery.md create mode 100644 agdb_api/php/docs/Model/InsertValuesQuery.md create mode 100644 agdb_api/php/docs/Model/QueryAudit.md create mode 100644 agdb_api/php/docs/Model/QueryCondition.md create mode 100644 agdb_api/php/docs/Model/QueryConditionData.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf1.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf2.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf3.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf4.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf5.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf6.md create mode 100644 agdb_api/php/docs/Model/QueryConditionDataOneOf7.md create mode 100644 agdb_api/php/docs/Model/QueryConditionLogic.md create mode 100644 agdb_api/php/docs/Model/QueryConditionModifier.md create mode 100644 agdb_api/php/docs/Model/QueryId.md create mode 100644 agdb_api/php/docs/Model/QueryIdOneOf.md create mode 100644 agdb_api/php/docs/Model/QueryIdOneOf1.md create mode 100644 agdb_api/php/docs/Model/QueryIds.md create mode 100644 agdb_api/php/docs/Model/QueryIdsOneOf.md create mode 100644 agdb_api/php/docs/Model/QueryIdsOneOf1.md create mode 100644 agdb_api/php/docs/Model/QueryResult.md create mode 100644 agdb_api/php/docs/Model/QueryType.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf1.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf10.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf11.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf12.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf13.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf14.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf15.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf16.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf2.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf3.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf4.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf5.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf6.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf7.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf8.md create mode 100644 agdb_api/php/docs/Model/QueryTypeOneOf9.md create mode 100644 agdb_api/php/docs/Model/QueryValues.md create mode 100644 agdb_api/php/docs/Model/QueryValuesOneOf.md create mode 100644 agdb_api/php/docs/Model/QueryValuesOneOf1.md create mode 100644 agdb_api/php/docs/Model/SearchQuery.md create mode 100644 agdb_api/php/docs/Model/SearchQueryAlgorithm.md create mode 100644 agdb_api/php/docs/Model/SelectEdgeCountQuery.md create mode 100644 agdb_api/php/docs/Model/SelectValuesQuery.md create mode 100644 agdb_api/php/docs/Model/ServerDatabase.md create mode 100644 agdb_api/php/docs/Model/ServerDatabaseRename.md create mode 100644 agdb_api/php/docs/Model/ServerDatabaseResource.md create mode 100644 agdb_api/php/docs/Model/UserCredentials.md create mode 100644 agdb_api/php/docs/Model/UserLogin.md create mode 100644 agdb_api/php/docs/Model/UserStatus.md create mode 100644 agdb_api/php/lib/Api/AgdbApi.php create mode 100644 agdb_api/php/lib/ApiException.php create mode 100644 agdb_api/php/lib/Configuration.php create mode 100644 agdb_api/php/lib/HeaderSelector.php create mode 100644 agdb_api/php/lib/Model/AdminStatus.php create mode 100644 agdb_api/php/lib/Model/ChangePassword.php create mode 100644 agdb_api/php/lib/Model/ClusterStatus.php create mode 100644 agdb_api/php/lib/Model/Comparison.php create mode 100644 agdb_api/php/lib/Model/ComparisonOneOf.php create mode 100644 agdb_api/php/lib/Model/ComparisonOneOf1.php create mode 100644 agdb_api/php/lib/Model/ComparisonOneOf2.php create mode 100644 agdb_api/php/lib/Model/ComparisonOneOf3.php create mode 100644 agdb_api/php/lib/Model/ComparisonOneOf4.php create mode 100644 agdb_api/php/lib/Model/ComparisonOneOf5.php create mode 100644 agdb_api/php/lib/Model/ComparisonOneOf6.php create mode 100644 agdb_api/php/lib/Model/CountComparison.php create mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf.php create mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf1.php create mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf2.php create mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf3.php create mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf4.php create mode 100644 agdb_api/php/lib/Model/CountComparisonOneOf5.php create mode 100644 agdb_api/php/lib/Model/DbElement.php create mode 100644 agdb_api/php/lib/Model/DbKeyOrder.php create mode 100644 agdb_api/php/lib/Model/DbKeyOrderOneOf.php create mode 100644 agdb_api/php/lib/Model/DbKeyOrderOneOf1.php create mode 100644 agdb_api/php/lib/Model/DbKeyValue.php create mode 100644 agdb_api/php/lib/Model/DbResource.php create mode 100644 agdb_api/php/lib/Model/DbType.php create mode 100644 agdb_api/php/lib/Model/DbTypeParam.php create mode 100644 agdb_api/php/lib/Model/DbUser.php create mode 100644 agdb_api/php/lib/Model/DbUserRole.php create mode 100644 agdb_api/php/lib/Model/DbUserRoleParam.php create mode 100644 agdb_api/php/lib/Model/DbValue.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf1.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf2.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf3.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf4.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf5.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf6.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf7.php create mode 100644 agdb_api/php/lib/Model/DbValueOneOf8.php create mode 100644 agdb_api/php/lib/Model/InsertAliasesQuery.php create mode 100644 agdb_api/php/lib/Model/InsertEdgesQuery.php create mode 100644 agdb_api/php/lib/Model/InsertNodesQuery.php create mode 100644 agdb_api/php/lib/Model/InsertValuesQuery.php create mode 100644 agdb_api/php/lib/Model/ModelInterface.php create mode 100644 agdb_api/php/lib/Model/QueryAudit.php create mode 100644 agdb_api/php/lib/Model/QueryCondition.php create mode 100644 agdb_api/php/lib/Model/QueryConditionData.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf1.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf2.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf3.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf4.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf5.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf6.php create mode 100644 agdb_api/php/lib/Model/QueryConditionDataOneOf7.php create mode 100644 agdb_api/php/lib/Model/QueryConditionLogic.php create mode 100644 agdb_api/php/lib/Model/QueryConditionModifier.php create mode 100644 agdb_api/php/lib/Model/QueryId.php create mode 100644 agdb_api/php/lib/Model/QueryIdOneOf.php create mode 100644 agdb_api/php/lib/Model/QueryIdOneOf1.php create mode 100644 agdb_api/php/lib/Model/QueryIds.php create mode 100644 agdb_api/php/lib/Model/QueryIdsOneOf.php create mode 100644 agdb_api/php/lib/Model/QueryIdsOneOf1.php create mode 100644 agdb_api/php/lib/Model/QueryResult.php create mode 100644 agdb_api/php/lib/Model/QueryType.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf1.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf10.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf11.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf12.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf13.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf14.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf15.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf16.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf2.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf3.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf4.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf5.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf6.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf7.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf8.php create mode 100644 agdb_api/php/lib/Model/QueryTypeOneOf9.php create mode 100644 agdb_api/php/lib/Model/QueryValues.php create mode 100644 agdb_api/php/lib/Model/QueryValuesOneOf.php create mode 100644 agdb_api/php/lib/Model/QueryValuesOneOf1.php create mode 100644 agdb_api/php/lib/Model/SearchQuery.php create mode 100644 agdb_api/php/lib/Model/SearchQueryAlgorithm.php create mode 100644 agdb_api/php/lib/Model/SelectEdgeCountQuery.php create mode 100644 agdb_api/php/lib/Model/SelectValuesQuery.php create mode 100644 agdb_api/php/lib/Model/ServerDatabase.php create mode 100644 agdb_api/php/lib/Model/ServerDatabaseRename.php create mode 100644 agdb_api/php/lib/Model/ServerDatabaseResource.php create mode 100644 agdb_api/php/lib/Model/UserCredentials.php create mode 100644 agdb_api/php/lib/Model/UserLogin.php create mode 100644 agdb_api/php/lib/Model/UserStatus.php create mode 100644 agdb_api/php/lib/ObjectSerializer.php diff --git a/agdb_api/php/README.md b/agdb_api/php/README.md index ed0b365b..f419b60e 100644 --- a/agdb_api/php/README.md +++ b/agdb_api/php/README.md @@ -80,6 +80,7 @@ Class | Method | HTTP request | Description *AgdbApi* | [**adminDbAdd**](docs/Api/AgdbApi.md#admindbadd) | **POST** /api/v1/admin/db/{owner}/{db}/add | *AgdbApi* | [**adminDbAudit**](docs/Api/AgdbApi.md#admindbaudit) | **GET** /api/v1/admin/db/{owner}/{db}/audit | *AgdbApi* | [**adminDbBackup**](docs/Api/AgdbApi.md#admindbbackup) | **POST** /api/v1/admin/db/{owner}/{db}/backup | +*AgdbApi* | [**adminDbClear**](docs/Api/AgdbApi.md#admindbclear) | **POST** /api/v1/admin/db/{owner}/{db}/clear | *AgdbApi* | [**adminDbConvert**](docs/Api/AgdbApi.md#admindbconvert) | **POST** /api/v1/admin/db/{owner}/{db}/convert | *AgdbApi* | [**adminDbCopy**](docs/Api/AgdbApi.md#admindbcopy) | **POST** /api/v1/admin/db/{owner}/{db}/copy | *AgdbApi* | [**adminDbDelete**](docs/Api/AgdbApi.md#admindbdelete) | **DELETE** /api/v1/admin/db/{owner}/{db}/delete | diff --git a/agdb_api/php/docs/Api/AgdbApi.md b/agdb_api/php/docs/Api/AgdbApi.md new file mode 100644 index 00000000..bf1d7944 --- /dev/null +++ b/agdb_api/php/docs/Api/AgdbApi.md @@ -0,0 +1,2696 @@ +# Agnesoft\AgdbApi\AgdbApi + +All URIs are relative to http://localhost:3000, except if the operation defines another base path. + +| Method | HTTP request | Description | +| ------------- | ------------- | ------------- | +| [**adminDbAdd()**](AgdbApi.md#adminDbAdd) | **POST** /api/v1/admin/db/{owner}/{db}/add | | +| [**adminDbAudit()**](AgdbApi.md#adminDbAudit) | **GET** /api/v1/admin/db/{owner}/{db}/audit | | +| [**adminDbBackup()**](AgdbApi.md#adminDbBackup) | **POST** /api/v1/admin/db/{owner}/{db}/backup | | +| [**adminDbClear()**](AgdbApi.md#adminDbClear) | **POST** /api/v1/admin/db/{owner}/{db}/clear | | +| [**adminDbConvert()**](AgdbApi.md#adminDbConvert) | **POST** /api/v1/admin/db/{owner}/{db}/convert | | +| [**adminDbCopy()**](AgdbApi.md#adminDbCopy) | **POST** /api/v1/admin/db/{owner}/{db}/copy | | +| [**adminDbDelete()**](AgdbApi.md#adminDbDelete) | **DELETE** /api/v1/admin/db/{owner}/{db}/delete | | +| [**adminDbExec()**](AgdbApi.md#adminDbExec) | **POST** /api/v1/admin/db/{owner}/{db}/exec | | +| [**adminDbList()**](AgdbApi.md#adminDbList) | **GET** /api/v1/admin/db/list | | +| [**adminDbOptimize()**](AgdbApi.md#adminDbOptimize) | **POST** /api/v1/admin/db/{owner}/{db}/optimize | | +| [**adminDbRemove()**](AgdbApi.md#adminDbRemove) | **DELETE** /api/v1/admin/db/{owner}/{db}/remove | | +| [**adminDbRename()**](AgdbApi.md#adminDbRename) | **POST** /api/v1/admin/db/{owner}/{db}/rename | | +| [**adminDbRestore()**](AgdbApi.md#adminDbRestore) | **POST** /api/v1/db/admin/{owner}/{db}/restore | | +| [**adminDbUserAdd()**](AgdbApi.md#adminDbUserAdd) | **PUT** /api/v1/admin/db/{owner}/{db}/user/{username}/add | | +| [**adminDbUserList()**](AgdbApi.md#adminDbUserList) | **GET** /api/v1/admin/db/{owner}/{db}/user/list | | +| [**adminDbUserRemove()**](AgdbApi.md#adminDbUserRemove) | **DELETE** /api/v1/admin/db/{owner}/{db}/user/{username}/remove | | +| [**adminShutdown()**](AgdbApi.md#adminShutdown) | **POST** /api/v1/admin/shutdown | | +| [**adminStatus()**](AgdbApi.md#adminStatus) | **GET** /api/v1/admin/status | | +| [**adminUserAdd()**](AgdbApi.md#adminUserAdd) | **POST** /api/v1/admin/user/{username}/add | | +| [**adminUserChangePassword()**](AgdbApi.md#adminUserChangePassword) | **PUT** /api/v1/admin/user/{username}/change_password | | +| [**adminUserList()**](AgdbApi.md#adminUserList) | **GET** /api/v1/admin/user/list | | +| [**adminUserLogout()**](AgdbApi.md#adminUserLogout) | **POST** /api/v1/admin/user/{username}/logout | | +| [**adminUserRemove()**](AgdbApi.md#adminUserRemove) | **DELETE** /api/v1/admin/user/{username}/remove | | +| [**clusterStatus()**](AgdbApi.md#clusterStatus) | **GET** /api/v1/cluster/status | | +| [**dbAdd()**](AgdbApi.md#dbAdd) | **POST** /api/v1/db/{owner}/{db}/add | | +| [**dbAudit()**](AgdbApi.md#dbAudit) | **GET** /api/v1/db/{owner}/{db}/audit | | +| [**dbBackup()**](AgdbApi.md#dbBackup) | **POST** /api/v1/db/{owner}/{db}/backup | | +| [**dbClear()**](AgdbApi.md#dbClear) | **POST** /api/v1/db/{owner}/{db}/clear | | +| [**dbConvert()**](AgdbApi.md#dbConvert) | **POST** /api/v1/db/{owner}/{db}/convert | | +| [**dbCopy()**](AgdbApi.md#dbCopy) | **POST** /api/v1/db/{owner}/{db}/copy | | +| [**dbDelete()**](AgdbApi.md#dbDelete) | **DELETE** /api/v1/db/{owner}/{db}/delete | | +| [**dbExec()**](AgdbApi.md#dbExec) | **POST** /api/v1/db/{owner}/{db}/exec | | +| [**dbList()**](AgdbApi.md#dbList) | **GET** /api/v1/db/list | | +| [**dbOptimize()**](AgdbApi.md#dbOptimize) | **POST** /api/v1/db/{owner}/{db}/optimize | | +| [**dbRemove()**](AgdbApi.md#dbRemove) | **DELETE** /api/v1/db/{owner}/{db}/remove | | +| [**dbRename()**](AgdbApi.md#dbRename) | **POST** /api/v1/db/{owner}/{db}/rename | | +| [**dbRestore()**](AgdbApi.md#dbRestore) | **POST** /api/v1/db/{owner}/{db}/restore | | +| [**dbUserAdd()**](AgdbApi.md#dbUserAdd) | **PUT** /api/v1/db/{owner}/{db}/user/{username}/add | | +| [**dbUserList()**](AgdbApi.md#dbUserList) | **GET** /api/v1/db/{owner}/{db}/user/list | | +| [**dbUserRemove()**](AgdbApi.md#dbUserRemove) | **POST** /api/v1/db/{owner}/{db}/user/{username}/remove | | +| [**status()**](AgdbApi.md#status) | **GET** /api/v1/status | | +| [**userChangePassword()**](AgdbApi.md#userChangePassword) | **PUT** /api/v1/user/change_password | | +| [**userLogin()**](AgdbApi.md#userLogin) | **POST** /api/v1/user/login | | +| [**userLogout()**](AgdbApi.md#userLogout) | **POST** /api/v1/user/logout | | +| [**userStatus()**](AgdbApi.md#userStatus) | **GET** /api/v1/user/status | | + + +## `adminDbAdd()` + +```php +adminDbAdd($owner, $db, $db_type) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name +$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType + +try { + $apiInstance->adminDbAdd($owner, $db, $db_type); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbAdd: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | +| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbAudit()` + +```php +adminDbAudit($owner, $db): \Agnesoft\AgdbApi\Model\QueryAudit[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $result = $apiInstance->adminDbAudit($owner, $db); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbAudit: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\QueryAudit[]**](../Model/QueryAudit.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbBackup()` + +```php +adminDbBackup($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->adminDbBackup($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbBackup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbClear()` + +```php +adminDbClear($owner, $db, $resource): \Agnesoft\AgdbApi\Model\ServerDatabase +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name +$resource = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbResource(); // \Agnesoft\AgdbApi\Model\DbResource + +try { + $result = $apiInstance->adminDbClear($owner, $db, $resource); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbClear: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | +| **resource** | [**\Agnesoft\AgdbApi\Model\DbResource**](../Model/.md)| | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\ServerDatabase**](../Model/ServerDatabase.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbConvert()` + +```php +adminDbConvert($owner, $db, $db_type) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name +$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType + +try { + $apiInstance->adminDbConvert($owner, $db, $db_type); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbConvert: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | +| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbCopy()` + +```php +adminDbCopy($owner, $db, $new_name) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$new_name = 'new_name_example'; // string + +try { + $apiInstance->adminDbCopy($owner, $db, $new_name); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbCopy: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **new_name** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbDelete()` + +```php +adminDbDelete($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->adminDbDelete($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbExec()` + +```php +adminDbExec($owner, $db, $query_type): \Agnesoft\AgdbApi\Model\QueryResult[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$query_type = array(new \Agnesoft\AgdbApi\Model\QueryType()); // \Agnesoft\AgdbApi\Model\QueryType[] + +try { + $result = $apiInstance->adminDbExec($owner, $db, $query_type); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbExec: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **query_type** | [**\Agnesoft\AgdbApi\Model\QueryType[]**](../Model/QueryType.md)| | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\QueryResult[]**](../Model/QueryResult.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbList()` + +```php +adminDbList(): \Agnesoft\AgdbApi\Model\ServerDatabase[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->adminDbList(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Agnesoft\AgdbApi\Model\ServerDatabase[]**](../Model/ServerDatabase.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbOptimize()` + +```php +adminDbOptimize($owner, $db): \Agnesoft\AgdbApi\Model\ServerDatabase +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $result = $apiInstance->adminDbOptimize($owner, $db); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbOptimize: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\ServerDatabase**](../Model/ServerDatabase.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbRemove()` + +```php +adminDbRemove($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->adminDbRemove($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbRemove: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbRename()` + +```php +adminDbRename($owner, $db, $new_name) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$new_name = 'new_name_example'; // string + +try { + $apiInstance->adminDbRename($owner, $db, $new_name); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbRename: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **new_name** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbRestore()` + +```php +adminDbRestore($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->adminDbRestore($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbRestore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbUserAdd()` + +```php +adminDbUserAdd($owner, $db, $username, $db_role) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$username = 'username_example'; // string | user name +$db_role = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbUserRole(); // \Agnesoft\AgdbApi\Model\DbUserRole + +try { + $apiInstance->adminDbUserAdd($owner, $db, $username, $db_role); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbUserAdd: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **username** | **string**| user name | | +| **db_role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](../Model/.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbUserList()` + +```php +adminDbUserList($owner, $db): \Agnesoft\AgdbApi\Model\DbUser[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name + +try { + $result = $apiInstance->adminDbUserList($owner, $db); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbUserList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\DbUser[]**](../Model/DbUser.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminDbUserRemove()` + +```php +adminDbUserRemove($owner, $db, $username) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$username = 'username_example'; // string | user name + +try { + $apiInstance->adminDbUserRemove($owner, $db, $username); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminDbUserRemove: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **username** | **string**| user name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminShutdown()` + +```php +adminShutdown() +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $apiInstance->adminShutdown(); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminShutdown: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminStatus()` + +```php +adminStatus(): \Agnesoft\AgdbApi\Model\AdminStatus +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->adminStatus(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminStatus: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Agnesoft\AgdbApi\Model\AdminStatus**](../Model/AdminStatus.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminUserAdd()` + +```php +adminUserAdd($username, $user_credentials) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$username = 'username_example'; // string | desired user name +$user_credentials = new \Agnesoft\AgdbApi\Model\UserCredentials(); // \Agnesoft\AgdbApi\Model\UserCredentials + +try { + $apiInstance->adminUserAdd($username, $user_credentials); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminUserAdd: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **username** | **string**| desired user name | | +| **user_credentials** | [**\Agnesoft\AgdbApi\Model\UserCredentials**](../Model/UserCredentials.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminUserChangePassword()` + +```php +adminUserChangePassword($username, $user_credentials) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$username = 'username_example'; // string | user name +$user_credentials = new \Agnesoft\AgdbApi\Model\UserCredentials(); // \Agnesoft\AgdbApi\Model\UserCredentials + +try { + $apiInstance->adminUserChangePassword($username, $user_credentials); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminUserChangePassword: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **username** | **string**| user name | | +| **user_credentials** | [**\Agnesoft\AgdbApi\Model\UserCredentials**](../Model/UserCredentials.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminUserList()` + +```php +adminUserList(): \Agnesoft\AgdbApi\Model\UserStatus[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->adminUserList(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminUserList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Agnesoft\AgdbApi\Model\UserStatus[]**](../Model/UserStatus.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminUserLogout()` + +```php +adminUserLogout($username) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$username = 'username_example'; // string | user name + +try { + $apiInstance->adminUserLogout($username); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminUserLogout: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **username** | **string**| user name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `adminUserRemove()` + +```php +adminUserRemove($username): \Agnesoft\AgdbApi\Model\UserStatus[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$username = 'username_example'; // string | user name + +try { + $result = $apiInstance->adminUserRemove($username); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->adminUserRemove: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **username** | **string**| user name | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\UserStatus[]**](../Model/UserStatus.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `clusterStatus()` + +```php +clusterStatus(): \Agnesoft\AgdbApi\Model\ClusterStatus[] +``` + + + +### Example + +```php +clusterStatus(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->clusterStatus: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Agnesoft\AgdbApi\Model\ClusterStatus[]**](../Model/ClusterStatus.md) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbAdd()` + +```php +dbAdd($owner, $db, $db_type) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name +$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType + +try { + $apiInstance->dbAdd($owner, $db, $db_type); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbAdd: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | +| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbAudit()` + +```php +dbAudit($owner, $db): \Agnesoft\AgdbApi\Model\QueryAudit[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $result = $apiInstance->dbAudit($owner, $db); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbAudit: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\QueryAudit[]**](../Model/QueryAudit.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbBackup()` + +```php +dbBackup($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->dbBackup($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbBackup: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbClear()` + +```php +dbClear($owner, $db, $resource): \Agnesoft\AgdbApi\Model\ServerDatabase +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name +$resource = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbResource(); // \Agnesoft\AgdbApi\Model\DbResource + +try { + $result = $apiInstance->dbClear($owner, $db, $resource); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbClear: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | +| **resource** | [**\Agnesoft\AgdbApi\Model\DbResource**](../Model/.md)| | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\ServerDatabase**](../Model/ServerDatabase.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbConvert()` + +```php +dbConvert($owner, $db, $db_type) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name +$db_type = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbType(); // \Agnesoft\AgdbApi\Model\DbType + +try { + $apiInstance->dbConvert($owner, $db, $db_type); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbConvert: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | +| **db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](../Model/.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbCopy()` + +```php +dbCopy($owner, $db, $new_name) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$new_name = 'new_name_example'; // string + +try { + $apiInstance->dbCopy($owner, $db, $new_name); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbCopy: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **new_name** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbDelete()` + +```php +dbDelete($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->dbDelete($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbDelete: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbExec()` + +```php +dbExec($owner, $db, $query_type): \Agnesoft\AgdbApi\Model\QueryResult[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$query_type = array(new \Agnesoft\AgdbApi\Model\QueryType()); // \Agnesoft\AgdbApi\Model\QueryType[] + +try { + $result = $apiInstance->dbExec($owner, $db, $query_type); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbExec: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **query_type** | [**\Agnesoft\AgdbApi\Model\QueryType[]**](../Model/QueryType.md)| | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\QueryResult[]**](../Model/QueryResult.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbList()` + +```php +dbList(): \Agnesoft\AgdbApi\Model\ServerDatabase[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->dbList(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Agnesoft\AgdbApi\Model\ServerDatabase[]**](../Model/ServerDatabase.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbOptimize()` + +```php +dbOptimize($owner, $db): \Agnesoft\AgdbApi\Model\ServerDatabase +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $result = $apiInstance->dbOptimize($owner, $db); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbOptimize: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\ServerDatabase**](../Model/ServerDatabase.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbRemove()` + +```php +dbRemove($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->dbRemove($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbRemove: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbRename()` + +```php +dbRename($owner, $db, $new_name) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$new_name = 'new_name_example'; // string + +try { + $apiInstance->dbRename($owner, $db, $new_name); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbRename: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **new_name** | **string**| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbRestore()` + +```php +dbRestore($owner, $db) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | user name +$db = 'db_example'; // string | db name + +try { + $apiInstance->dbRestore($owner, $db); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbRestore: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| user name | | +| **db** | **string**| db name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbUserAdd()` + +```php +dbUserAdd($owner, $db, $username, $db_role) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$username = 'username_example'; // string | user name +$db_role = new \Agnesoft\AgdbApi\Model\\Agnesoft\AgdbApi\Model\DbUserRole(); // \Agnesoft\AgdbApi\Model\DbUserRole + +try { + $apiInstance->dbUserAdd($owner, $db, $username, $db_role); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbUserAdd: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **username** | **string**| user name | | +| **db_role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](../Model/.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbUserList()` + +```php +dbUserList($owner, $db): \Agnesoft\AgdbApi\Model\DbUser[] +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name + +try { + $result = $apiInstance->dbUserList($owner, $db); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbUserList: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | + +### Return type + +[**\Agnesoft\AgdbApi\Model\DbUser[]**](../Model/DbUser.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `dbUserRemove()` + +```php +dbUserRemove($owner, $db, $username) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$owner = 'owner_example'; // string | db owner user name +$db = 'db_example'; // string | db name +$username = 'username_example'; // string | user name + +try { + $apiInstance->dbUserRemove($owner, $db, $username); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->dbUserRemove: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **owner** | **string**| db owner user name | | +| **db** | **string**| db name | | +| **username** | **string**| user name | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `status()` + +```php +status() +``` + + + +### Example + +```php +status(); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->status: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `userChangePassword()` + +```php +userChangePassword($change_password) +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); +$change_password = new \Agnesoft\AgdbApi\Model\ChangePassword(); // \Agnesoft\AgdbApi\Model\ChangePassword + +try { + $apiInstance->userChangePassword($change_password); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->userChangePassword: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **change_password** | [**\Agnesoft\AgdbApi\Model\ChangePassword**](../Model/ChangePassword.md)| | | + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `userLogin()` + +```php +userLogin($user_login): string +``` + + + +### Example + +```php +userLogin($user_login); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->userLogin: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +| Name | Type | Description | Notes | +| ------------- | ------------- | ------------- | ------------- | +| **user_login** | [**\Agnesoft\AgdbApi\Model\UserLogin**](../Model/UserLogin.md)| | | + +### Return type + +**string** + +### Authorization + +No authorization required + +### HTTP request headers + +- **Content-Type**: `application/json` +- **Accept**: `text/plain` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `userLogout()` + +```php +userLogout() +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $apiInstance->userLogout(); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->userLogout: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +void (empty response body) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: Not defined + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) + +## `userStatus()` + +```php +userStatus(): \Agnesoft\AgdbApi\Model\UserStatus +``` + + + +### Example + +```php +setAccessToken('YOUR_ACCESS_TOKEN'); + + +$apiInstance = new Agnesoft\AgdbApi\Api\AgdbApi( + // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. + // This is optional, `GuzzleHttp\Client` will be used as default. + new GuzzleHttp\Client(), + $config +); + +try { + $result = $apiInstance->userStatus(); + print_r($result); +} catch (Exception $e) { + echo 'Exception when calling AgdbApi->userStatus: ', $e->getMessage(), PHP_EOL; +} +``` + +### Parameters + +This endpoint does not need any parameter. + +### Return type + +[**\Agnesoft\AgdbApi\Model\UserStatus**](../Model/UserStatus.md) + +### Authorization + +[Token](../../README.md#Token) + +### HTTP request headers + +- **Content-Type**: Not defined +- **Accept**: `application/json` + +[[Back to top]](#) [[Back to API list]](../../README.md#endpoints) +[[Back to Model list]](../../README.md#models) +[[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/AdminStatus.md b/agdb_api/php/docs/Model/AdminStatus.md new file mode 100644 index 00000000..8064c920 --- /dev/null +++ b/agdb_api/php/docs/Model/AdminStatus.md @@ -0,0 +1,13 @@ +# # AdminStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**dbs** | **int** | | +**logged_in_users** | **int** | | +**size** | **int** | | +**uptime** | **int** | | +**users** | **int** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ChangePassword.md b/agdb_api/php/docs/Model/ChangePassword.md new file mode 100644 index 00000000..303d974b --- /dev/null +++ b/agdb_api/php/docs/Model/ChangePassword.md @@ -0,0 +1,10 @@ +# # ChangePassword + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**new_password** | **string** | | +**password** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ClusterStatus.md b/agdb_api/php/docs/Model/ClusterStatus.md new file mode 100644 index 00000000..3e81a143 --- /dev/null +++ b/agdb_api/php/docs/Model/ClusterStatus.md @@ -0,0 +1,13 @@ +# # ClusterStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**address** | **string** | | +**commit** | **int** | | +**leader** | **bool** | | +**status** | **bool** | | +**term** | **int** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/Comparison.md b/agdb_api/php/docs/Model/Comparison.md new file mode 100644 index 00000000..efad71d5 --- /dev/null +++ b/agdb_api/php/docs/Model/Comparison.md @@ -0,0 +1,15 @@ +# # Comparison + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**greater_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**greater_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**less_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**less_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**not_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**contains** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf.md b/agdb_api/php/docs/Model/ComparisonOneOf.md new file mode 100644 index 00000000..aa25edb3 --- /dev/null +++ b/agdb_api/php/docs/Model/ComparisonOneOf.md @@ -0,0 +1,9 @@ +# # ComparisonOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf1.md b/agdb_api/php/docs/Model/ComparisonOneOf1.md new file mode 100644 index 00000000..47e5990d --- /dev/null +++ b/agdb_api/php/docs/Model/ComparisonOneOf1.md @@ -0,0 +1,9 @@ +# # ComparisonOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**greater_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf2.md b/agdb_api/php/docs/Model/ComparisonOneOf2.md new file mode 100644 index 00000000..ea12a9ec --- /dev/null +++ b/agdb_api/php/docs/Model/ComparisonOneOf2.md @@ -0,0 +1,9 @@ +# # ComparisonOneOf2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**greater_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf3.md b/agdb_api/php/docs/Model/ComparisonOneOf3.md new file mode 100644 index 00000000..e749ef0e --- /dev/null +++ b/agdb_api/php/docs/Model/ComparisonOneOf3.md @@ -0,0 +1,9 @@ +# # ComparisonOneOf3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**less_than** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf4.md b/agdb_api/php/docs/Model/ComparisonOneOf4.md new file mode 100644 index 00000000..485bdb38 --- /dev/null +++ b/agdb_api/php/docs/Model/ComparisonOneOf4.md @@ -0,0 +1,9 @@ +# # ComparisonOneOf4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**less_than_or_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf5.md b/agdb_api/php/docs/Model/ComparisonOneOf5.md new file mode 100644 index 00000000..61089d1e --- /dev/null +++ b/agdb_api/php/docs/Model/ComparisonOneOf5.md @@ -0,0 +1,9 @@ +# # ComparisonOneOf5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**not_equal** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ComparisonOneOf6.md b/agdb_api/php/docs/Model/ComparisonOneOf6.md new file mode 100644 index 00000000..dbfab86d --- /dev/null +++ b/agdb_api/php/docs/Model/ComparisonOneOf6.md @@ -0,0 +1,9 @@ +# # ComparisonOneOf6 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**contains** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparison.md b/agdb_api/php/docs/Model/CountComparison.md new file mode 100644 index 00000000..3d764d53 --- /dev/null +++ b/agdb_api/php/docs/Model/CountComparison.md @@ -0,0 +1,14 @@ +# # CountComparison + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**equal** | **int** | property == this | +**greater_than** | **int** | property > this | +**greater_than_or_equal** | **int** | property >= this | +**less_than** | **int** | property < this | +**less_than_or_equal** | **int** | property <= this | +**not_equal** | **int** | property != this | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf.md b/agdb_api/php/docs/Model/CountComparisonOneOf.md new file mode 100644 index 00000000..1c54e5b7 --- /dev/null +++ b/agdb_api/php/docs/Model/CountComparisonOneOf.md @@ -0,0 +1,9 @@ +# # CountComparisonOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**equal** | **int** | property == this | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf1.md b/agdb_api/php/docs/Model/CountComparisonOneOf1.md new file mode 100644 index 00000000..f3a5dcb8 --- /dev/null +++ b/agdb_api/php/docs/Model/CountComparisonOneOf1.md @@ -0,0 +1,9 @@ +# # CountComparisonOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**greater_than** | **int** | property > this | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf2.md b/agdb_api/php/docs/Model/CountComparisonOneOf2.md new file mode 100644 index 00000000..f441cdae --- /dev/null +++ b/agdb_api/php/docs/Model/CountComparisonOneOf2.md @@ -0,0 +1,9 @@ +# # CountComparisonOneOf2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**greater_than_or_equal** | **int** | property >= this | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf3.md b/agdb_api/php/docs/Model/CountComparisonOneOf3.md new file mode 100644 index 00000000..27511458 --- /dev/null +++ b/agdb_api/php/docs/Model/CountComparisonOneOf3.md @@ -0,0 +1,9 @@ +# # CountComparisonOneOf3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**less_than** | **int** | property < this | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf4.md b/agdb_api/php/docs/Model/CountComparisonOneOf4.md new file mode 100644 index 00000000..fa872bcb --- /dev/null +++ b/agdb_api/php/docs/Model/CountComparisonOneOf4.md @@ -0,0 +1,9 @@ +# # CountComparisonOneOf4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**less_than_or_equal** | **int** | property <= this | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/CountComparisonOneOf5.md b/agdb_api/php/docs/Model/CountComparisonOneOf5.md new file mode 100644 index 00000000..5b6e9da6 --- /dev/null +++ b/agdb_api/php/docs/Model/CountComparisonOneOf5.md @@ -0,0 +1,9 @@ +# # CountComparisonOneOf5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**not_equal** | **int** | property != this | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbElement.md b/agdb_api/php/docs/Model/DbElement.md new file mode 100644 index 00000000..048447e4 --- /dev/null +++ b/agdb_api/php/docs/Model/DbElement.md @@ -0,0 +1,12 @@ +# # DbElement + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | [optional] +**id** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | +**to** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | [optional] +**values** | [**\Agnesoft\AgdbApi\Model\DbKeyValue[]**](DbKeyValue.md) | List of key-value pairs associated with the element. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyOrder.md b/agdb_api/php/docs/Model/DbKeyOrder.md new file mode 100644 index 00000000..af990bf0 --- /dev/null +++ b/agdb_api/php/docs/Model/DbKeyOrder.md @@ -0,0 +1,10 @@ +# # DbKeyOrder + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**desc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyOrderOneOf.md b/agdb_api/php/docs/Model/DbKeyOrderOneOf.md new file mode 100644 index 00000000..1de1bbaa --- /dev/null +++ b/agdb_api/php/docs/Model/DbKeyOrderOneOf.md @@ -0,0 +1,9 @@ +# # DbKeyOrderOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**asc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyOrderOneOf1.md b/agdb_api/php/docs/Model/DbKeyOrderOneOf1.md new file mode 100644 index 00000000..10d87bb9 --- /dev/null +++ b/agdb_api/php/docs/Model/DbKeyOrderOneOf1.md @@ -0,0 +1,9 @@ +# # DbKeyOrderOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**desc** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbKeyValue.md b/agdb_api/php/docs/Model/DbKeyValue.md new file mode 100644 index 00000000..663bb375 --- /dev/null +++ b/agdb_api/php/docs/Model/DbKeyValue.md @@ -0,0 +1,10 @@ +# # DbKeyValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**value** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbResource.md b/agdb_api/php/docs/Model/DbResource.md new file mode 100644 index 00000000..f069b646 --- /dev/null +++ b/agdb_api/php/docs/Model/DbResource.md @@ -0,0 +1,8 @@ +# # DbResource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbType.md b/agdb_api/php/docs/Model/DbType.md new file mode 100644 index 00000000..3105f244 --- /dev/null +++ b/agdb_api/php/docs/Model/DbType.md @@ -0,0 +1,8 @@ +# # DbType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbTypeParam.md b/agdb_api/php/docs/Model/DbTypeParam.md new file mode 100644 index 00000000..190155fa --- /dev/null +++ b/agdb_api/php/docs/Model/DbTypeParam.md @@ -0,0 +1,9 @@ +# # DbTypeParam + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](DbType.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbUser.md b/agdb_api/php/docs/Model/DbUser.md new file mode 100644 index 00000000..210d6fde --- /dev/null +++ b/agdb_api/php/docs/Model/DbUser.md @@ -0,0 +1,10 @@ +# # DbUser + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](DbUserRole.md) | | +**user** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbUserRole.md b/agdb_api/php/docs/Model/DbUserRole.md new file mode 100644 index 00000000..6a77a73a --- /dev/null +++ b/agdb_api/php/docs/Model/DbUserRole.md @@ -0,0 +1,8 @@ +# # DbUserRole + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbUserRoleParam.md b/agdb_api/php/docs/Model/DbUserRoleParam.md new file mode 100644 index 00000000..315704aa --- /dev/null +++ b/agdb_api/php/docs/Model/DbUserRoleParam.md @@ -0,0 +1,9 @@ +# # DbUserRoleParam + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**db_role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](DbUserRole.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValue.md b/agdb_api/php/docs/Model/DbValue.md new file mode 100644 index 00000000..10cf9313 --- /dev/null +++ b/agdb_api/php/docs/Model/DbValue.md @@ -0,0 +1,17 @@ +# # DbValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bytes** | **\SplFileObject** | Byte array, sometimes referred to as blob | +**i64** | **int** | 64-bit wide signed integer | +**u64** | **int** | 64-bit wide unsigned integer | +**f64** | **float** | Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. | +**string** | **string** | UTF-8 string | +**vec_i64** | **int[]** | List of 64-bit wide signed integers | +**vec_u64** | **int[]** | List of 64-bit wide unsigned integers | +**vec_f64** | **float[]** | List of 64-bit floating point numbers | +**vec_string** | **string[]** | List of UTF-8 strings | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf.md b/agdb_api/php/docs/Model/DbValueOneOf.md new file mode 100644 index 00000000..9790862b --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf.md @@ -0,0 +1,9 @@ +# # DbValueOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**bytes** | **\SplFileObject** | Byte array, sometimes referred to as blob | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf1.md b/agdb_api/php/docs/Model/DbValueOneOf1.md new file mode 100644 index 00000000..3041c3d4 --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf1.md @@ -0,0 +1,9 @@ +# # DbValueOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**i64** | **int** | 64-bit wide signed integer | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf2.md b/agdb_api/php/docs/Model/DbValueOneOf2.md new file mode 100644 index 00000000..7015fa78 --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf2.md @@ -0,0 +1,9 @@ +# # DbValueOneOf2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**u64** | **int** | 64-bit wide unsigned integer | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf3.md b/agdb_api/php/docs/Model/DbValueOneOf3.md new file mode 100644 index 00000000..bc77db84 --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf3.md @@ -0,0 +1,9 @@ +# # DbValueOneOf3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**f64** | **float** | Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf4.md b/agdb_api/php/docs/Model/DbValueOneOf4.md new file mode 100644 index 00000000..9bcb40bd --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf4.md @@ -0,0 +1,9 @@ +# # DbValueOneOf4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**string** | **string** | UTF-8 string | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf5.md b/agdb_api/php/docs/Model/DbValueOneOf5.md new file mode 100644 index 00000000..c54a4509 --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf5.md @@ -0,0 +1,9 @@ +# # DbValueOneOf5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vec_i64** | **int[]** | List of 64-bit wide signed integers | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf6.md b/agdb_api/php/docs/Model/DbValueOneOf6.md new file mode 100644 index 00000000..04c8c49d --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf6.md @@ -0,0 +1,9 @@ +# # DbValueOneOf6 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vec_u64** | **int[]** | List of 64-bit wide unsigned integers | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf7.md b/agdb_api/php/docs/Model/DbValueOneOf7.md new file mode 100644 index 00000000..02a41a37 --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf7.md @@ -0,0 +1,9 @@ +# # DbValueOneOf7 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vec_f64** | **float[]** | List of 64-bit floating point numbers | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/DbValueOneOf8.md b/agdb_api/php/docs/Model/DbValueOneOf8.md new file mode 100644 index 00000000..6d3cfe0f --- /dev/null +++ b/agdb_api/php/docs/Model/DbValueOneOf8.md @@ -0,0 +1,9 @@ +# # DbValueOneOf8 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**vec_string** | **string[]** | List of UTF-8 strings | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertAliasesQuery.md b/agdb_api/php/docs/Model/InsertAliasesQuery.md new file mode 100644 index 00000000..ff7d8c4d --- /dev/null +++ b/agdb_api/php/docs/Model/InsertAliasesQuery.md @@ -0,0 +1,10 @@ +# # InsertAliasesQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**aliases** | **string[]** | Aliases to be inserted | +**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertEdgesQuery.md b/agdb_api/php/docs/Model/InsertEdgesQuery.md new file mode 100644 index 00000000..0f5841e4 --- /dev/null +++ b/agdb_api/php/docs/Model/InsertEdgesQuery.md @@ -0,0 +1,13 @@ +# # InsertEdgesQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**each** | **bool** | If `true` create an edge between each origin and destination. | +**from** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**to** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**values** | [**\Agnesoft\AgdbApi\Model\QueryValues**](QueryValues.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertNodesQuery.md b/agdb_api/php/docs/Model/InsertNodesQuery.md new file mode 100644 index 00000000..6cc75b54 --- /dev/null +++ b/agdb_api/php/docs/Model/InsertNodesQuery.md @@ -0,0 +1,12 @@ +# # InsertNodesQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**aliases** | **string[]** | Aliases of the new nodes. | +**count** | **int** | Number of nodes to be inserted. | +**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**values** | [**\Agnesoft\AgdbApi\Model\QueryValues**](QueryValues.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/InsertValuesQuery.md b/agdb_api/php/docs/Model/InsertValuesQuery.md new file mode 100644 index 00000000..383a2a02 --- /dev/null +++ b/agdb_api/php/docs/Model/InsertValuesQuery.md @@ -0,0 +1,10 @@ +# # InsertValuesQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**values** | [**\Agnesoft\AgdbApi\Model\QueryValues**](QueryValues.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryAudit.md b/agdb_api/php/docs/Model/QueryAudit.md new file mode 100644 index 00000000..d9f2c0d8 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryAudit.md @@ -0,0 +1,11 @@ +# # QueryAudit + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**query** | [**\Agnesoft\AgdbApi\Model\QueryType**](QueryType.md) | | +**timestamp** | **int** | | +**user** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryCondition.md b/agdb_api/php/docs/Model/QueryCondition.md new file mode 100644 index 00000000..df8693b9 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryCondition.md @@ -0,0 +1,11 @@ +# # QueryCondition + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**data** | [**\Agnesoft\AgdbApi\Model\QueryConditionData**](QueryConditionData.md) | | +**logic** | [**\Agnesoft\AgdbApi\Model\QueryConditionLogic**](QueryConditionLogic.md) | | +**modifier** | [**\Agnesoft\AgdbApi\Model\QueryConditionModifier**](QueryConditionModifier.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionData.md b/agdb_api/php/docs/Model/QueryConditionData.md new file mode 100644 index 00000000..503a092c --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionData.md @@ -0,0 +1,16 @@ +# # QueryConditionData + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**distance** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | +**edge_count** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | +**edge_count_from** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | +**edge_count_to** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | +**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | Tests if the current id is in the list of ids. | +**key_value** | [**\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue**](QueryConditionDataOneOf5KeyValue.md) | | +**keys** | [**\Agnesoft\AgdbApi\Model\DbValue[]**](DbValue.md) | Test if the current element has **all** of the keys listed. | +**where** | [**\Agnesoft\AgdbApi\Model\QueryCondition[]**](QueryCondition.md) | Nested list of conditions (equivalent to brackets). | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf.md new file mode 100644 index 00000000..b4f24a82 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**distance** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf1.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf1.md new file mode 100644 index 00000000..b5af9f92 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf1.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**edge_count** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf2.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf2.md new file mode 100644 index 00000000..94632b44 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf2.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**edge_count_from** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf3.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf3.md new file mode 100644 index 00000000..647e90d2 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf3.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**edge_count_to** | [**\Agnesoft\AgdbApi\Model\CountComparison**](CountComparison.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf4.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf4.md new file mode 100644 index 00000000..899dd7ea --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf4.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | Tests if the current id is in the list of ids. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf5.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf5.md new file mode 100644 index 00000000..3815cb25 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf5.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key_value** | [**\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue**](QueryConditionDataOneOf5KeyValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md new file mode 100644 index 00000000..978dcac6 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf5KeyValue.md @@ -0,0 +1,10 @@ +# # QueryConditionDataOneOf5KeyValue + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**key** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**value** | [**\Agnesoft\AgdbApi\Model\Comparison**](Comparison.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf6.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf6.md new file mode 100644 index 00000000..ad7ba7bb --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf6.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf6 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**keys** | [**\Agnesoft\AgdbApi\Model\DbValue[]**](DbValue.md) | Test if the current element has **all** of the keys listed. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionDataOneOf7.md b/agdb_api/php/docs/Model/QueryConditionDataOneOf7.md new file mode 100644 index 00000000..702fff07 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionDataOneOf7.md @@ -0,0 +1,9 @@ +# # QueryConditionDataOneOf7 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**where** | [**\Agnesoft\AgdbApi\Model\QueryCondition[]**](QueryCondition.md) | Nested list of conditions (equivalent to brackets). | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionLogic.md b/agdb_api/php/docs/Model/QueryConditionLogic.md new file mode 100644 index 00000000..09262f08 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionLogic.md @@ -0,0 +1,8 @@ +# # QueryConditionLogic + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryConditionModifier.md b/agdb_api/php/docs/Model/QueryConditionModifier.md new file mode 100644 index 00000000..89857ecf --- /dev/null +++ b/agdb_api/php/docs/Model/QueryConditionModifier.md @@ -0,0 +1,8 @@ +# # QueryConditionModifier + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryId.md b/agdb_api/php/docs/Model/QueryId.md new file mode 100644 index 00000000..eb0bb2f5 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryId.md @@ -0,0 +1,10 @@ +# # QueryId + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | +**alias** | **string** | String alias | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdOneOf.md b/agdb_api/php/docs/Model/QueryIdOneOf.md new file mode 100644 index 00000000..3d33d36d --- /dev/null +++ b/agdb_api/php/docs/Model/QueryIdOneOf.md @@ -0,0 +1,9 @@ +# # QueryIdOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**id** | **int** | Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdOneOf1.md b/agdb_api/php/docs/Model/QueryIdOneOf1.md new file mode 100644 index 00000000..23b97a7b --- /dev/null +++ b/agdb_api/php/docs/Model/QueryIdOneOf1.md @@ -0,0 +1,9 @@ +# # QueryIdOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**alias** | **string** | String alias | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIds.md b/agdb_api/php/docs/Model/QueryIds.md new file mode 100644 index 00000000..35328ff8 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryIds.md @@ -0,0 +1,10 @@ +# # QueryIds + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | List of [`QueryId`]s | +**search** | [**\Agnesoft\AgdbApi\Model\SearchQuery**](SearchQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdsOneOf.md b/agdb_api/php/docs/Model/QueryIdsOneOf.md new file mode 100644 index 00000000..a882f791 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryIdsOneOf.md @@ -0,0 +1,9 @@ +# # QueryIdsOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | [**\Agnesoft\AgdbApi\Model\QueryId[]**](QueryId.md) | List of [`QueryId`]s | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryIdsOneOf1.md b/agdb_api/php/docs/Model/QueryIdsOneOf1.md new file mode 100644 index 00000000..8f81a659 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryIdsOneOf1.md @@ -0,0 +1,9 @@ +# # QueryIdsOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**search** | [**\Agnesoft\AgdbApi\Model\SearchQuery**](SearchQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryResult.md b/agdb_api/php/docs/Model/QueryResult.md new file mode 100644 index 00000000..3ff74508 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryResult.md @@ -0,0 +1,10 @@ +# # QueryResult + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**elements** | [**\Agnesoft\AgdbApi\Model\DbElement[]**](DbElement.md) | List of elements yielded by the query possibly with a list of properties. | +**result** | **int** | Query result | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryType.md b/agdb_api/php/docs/Model/QueryType.md new file mode 100644 index 00000000..07ea0951 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryType.md @@ -0,0 +1,26 @@ +# # QueryType + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**insert_alias** | [**\Agnesoft\AgdbApi\Model\InsertAliasesQuery**](InsertAliasesQuery.md) | | +**insert_edges** | [**\Agnesoft\AgdbApi\Model\InsertEdgesQuery**](InsertEdgesQuery.md) | | +**insert_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**insert_nodes** | [**\Agnesoft\AgdbApi\Model\InsertNodesQuery**](InsertNodesQuery.md) | | +**insert_values** | [**\Agnesoft\AgdbApi\Model\InsertValuesQuery**](InsertValuesQuery.md) | | +**remove** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**remove_aliases** | **string[]** | Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. | +**remove_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | +**remove_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | +**search** | [**\Agnesoft\AgdbApi\Model\SearchQuery**](SearchQuery.md) | | +**select_aliases** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**select_all_aliases** | **object** | Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. | +**select_edge_count** | [**\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery**](SelectEdgeCountQuery.md) | | +**select_indexes** | **object** | Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. | +**select_keys** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**select_key_count** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**select_node_count** | **object** | Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. | +**select_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf.md b/agdb_api/php/docs/Model/QueryTypeOneOf.md new file mode 100644 index 00000000..43fea3b2 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**insert_alias** | [**\Agnesoft\AgdbApi\Model\InsertAliasesQuery**](InsertAliasesQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf1.md b/agdb_api/php/docs/Model/QueryTypeOneOf1.md new file mode 100644 index 00000000..dd2ac404 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf1.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**insert_edges** | [**\Agnesoft\AgdbApi\Model\InsertEdgesQuery**](InsertEdgesQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf10.md b/agdb_api/php/docs/Model/QueryTypeOneOf10.md new file mode 100644 index 00000000..b5331877 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf10.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf10 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_all_aliases** | **object** | Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf11.md b/agdb_api/php/docs/Model/QueryTypeOneOf11.md new file mode 100644 index 00000000..8d7c9bb7 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf11.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf11 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_edge_count** | [**\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery**](SelectEdgeCountQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf12.md b/agdb_api/php/docs/Model/QueryTypeOneOf12.md new file mode 100644 index 00000000..c0c9803b --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf12.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf12 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_indexes** | **object** | Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf13.md b/agdb_api/php/docs/Model/QueryTypeOneOf13.md new file mode 100644 index 00000000..ce49cdf3 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf13.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf13 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_keys** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf14.md b/agdb_api/php/docs/Model/QueryTypeOneOf14.md new file mode 100644 index 00000000..31fe5c86 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf14.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf14 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_key_count** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf15.md b/agdb_api/php/docs/Model/QueryTypeOneOf15.md new file mode 100644 index 00000000..e5eee1ed --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf15.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf15 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_node_count** | **object** | Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf16.md b/agdb_api/php/docs/Model/QueryTypeOneOf16.md new file mode 100644 index 00000000..c7338d5c --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf16.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf16 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf2.md b/agdb_api/php/docs/Model/QueryTypeOneOf2.md new file mode 100644 index 00000000..243dac8d --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf2.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf2 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**insert_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf3.md b/agdb_api/php/docs/Model/QueryTypeOneOf3.md new file mode 100644 index 00000000..0c68f574 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf3.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf3 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**insert_nodes** | [**\Agnesoft\AgdbApi\Model\InsertNodesQuery**](InsertNodesQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf4.md b/agdb_api/php/docs/Model/QueryTypeOneOf4.md new file mode 100644 index 00000000..3645a038 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf4.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf4 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**insert_values** | [**\Agnesoft\AgdbApi\Model\InsertValuesQuery**](InsertValuesQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf5.md b/agdb_api/php/docs/Model/QueryTypeOneOf5.md new file mode 100644 index 00000000..31293bc1 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf5.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf5 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**remove** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf6.md b/agdb_api/php/docs/Model/QueryTypeOneOf6.md new file mode 100644 index 00000000..93fa6ef7 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf6.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf6 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**remove_aliases** | **string[]** | Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf7.md b/agdb_api/php/docs/Model/QueryTypeOneOf7.md new file mode 100644 index 00000000..37fcdb20 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf7.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf7 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**remove_index** | [**\Agnesoft\AgdbApi\Model\DbValue**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf8.md b/agdb_api/php/docs/Model/QueryTypeOneOf8.md new file mode 100644 index 00000000..ef4f97f3 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf8.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf8 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**remove_values** | [**\Agnesoft\AgdbApi\Model\SelectValuesQuery**](SelectValuesQuery.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryTypeOneOf9.md b/agdb_api/php/docs/Model/QueryTypeOneOf9.md new file mode 100644 index 00000000..fee634c6 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryTypeOneOf9.md @@ -0,0 +1,9 @@ +# # QueryTypeOneOf9 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**select_aliases** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryValues.md b/agdb_api/php/docs/Model/QueryValues.md new file mode 100644 index 00000000..5d54850f --- /dev/null +++ b/agdb_api/php/docs/Model/QueryValues.md @@ -0,0 +1,10 @@ +# # QueryValues + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**single** | [**\Agnesoft\AgdbApi\Model\DbKeyValue[]**](DbKeyValue.md) | Single list of properties (key-value pairs) to be applied to all elements in a query. | +**multi** | **\Agnesoft\AgdbApi\Model\DbKeyValue[][]** | List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryValuesOneOf.md b/agdb_api/php/docs/Model/QueryValuesOneOf.md new file mode 100644 index 00000000..3b703a4c --- /dev/null +++ b/agdb_api/php/docs/Model/QueryValuesOneOf.md @@ -0,0 +1,9 @@ +# # QueryValuesOneOf + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**single** | [**\Agnesoft\AgdbApi\Model\DbKeyValue[]**](DbKeyValue.md) | Single list of properties (key-value pairs) to be applied to all elements in a query. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/QueryValuesOneOf1.md b/agdb_api/php/docs/Model/QueryValuesOneOf1.md new file mode 100644 index 00000000..996395d6 --- /dev/null +++ b/agdb_api/php/docs/Model/QueryValuesOneOf1.md @@ -0,0 +1,9 @@ +# # QueryValuesOneOf1 + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**multi** | **\Agnesoft\AgdbApi\Model\DbKeyValue[][]** | List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SearchQuery.md b/agdb_api/php/docs/Model/SearchQuery.md new file mode 100644 index 00000000..6f7c7d46 --- /dev/null +++ b/agdb_api/php/docs/Model/SearchQuery.md @@ -0,0 +1,15 @@ +# # SearchQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**algorithm** | [**\Agnesoft\AgdbApi\Model\SearchQueryAlgorithm**](SearchQueryAlgorithm.md) | | +**conditions** | [**\Agnesoft\AgdbApi\Model\QueryCondition[]**](QueryCondition.md) | Set of conditions every element must satisfy to be included in the result. Some conditions also influence the search path as well. | +**destination** | [**\Agnesoft\AgdbApi\Model\QueryId**](QueryId.md) | | +**limit** | **int** | How many elements maximum to return. | +**offset** | **int** | How many elements that would be returned should be skipped in the result. | +**order_by** | [**\Agnesoft\AgdbApi\Model\DbKeyOrder[]**](DbKeyOrder.md) | Order of the elements in the result. The sorting happens before `offset` and `limit` are applied. | +**origin** | [**\Agnesoft\AgdbApi\Model\QueryId**](QueryId.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SearchQueryAlgorithm.md b/agdb_api/php/docs/Model/SearchQueryAlgorithm.md new file mode 100644 index 00000000..1c35f207 --- /dev/null +++ b/agdb_api/php/docs/Model/SearchQueryAlgorithm.md @@ -0,0 +1,8 @@ +# # SearchQueryAlgorithm + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SelectEdgeCountQuery.md b/agdb_api/php/docs/Model/SelectEdgeCountQuery.md new file mode 100644 index 00000000..692d37ec --- /dev/null +++ b/agdb_api/php/docs/Model/SelectEdgeCountQuery.md @@ -0,0 +1,11 @@ +# # SelectEdgeCountQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**from** | **bool** | If set to `true` the query will count outgoing edges from the nodes. | +**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**to** | **bool** | If set to `true` the query will count incoming edges to the nodes. | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/SelectValuesQuery.md b/agdb_api/php/docs/Model/SelectValuesQuery.md new file mode 100644 index 00000000..d9fac118 --- /dev/null +++ b/agdb_api/php/docs/Model/SelectValuesQuery.md @@ -0,0 +1,10 @@ +# # SelectValuesQuery + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**ids** | [**\Agnesoft\AgdbApi\Model\QueryIds**](QueryIds.md) | | +**keys** | [**\Agnesoft\AgdbApi\Model\DbValue[]**](DbValue.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ServerDatabase.md b/agdb_api/php/docs/Model/ServerDatabase.md new file mode 100644 index 00000000..7aba497c --- /dev/null +++ b/agdb_api/php/docs/Model/ServerDatabase.md @@ -0,0 +1,13 @@ +# # ServerDatabase + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**backup** | **int** | | +**db_type** | [**\Agnesoft\AgdbApi\Model\DbType**](DbType.md) | | +**name** | **string** | | +**role** | [**\Agnesoft\AgdbApi\Model\DbUserRole**](DbUserRole.md) | | +**size** | **int** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ServerDatabaseRename.md b/agdb_api/php/docs/Model/ServerDatabaseRename.md new file mode 100644 index 00000000..fd9ce4e6 --- /dev/null +++ b/agdb_api/php/docs/Model/ServerDatabaseRename.md @@ -0,0 +1,9 @@ +# # ServerDatabaseRename + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**new_name** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/ServerDatabaseResource.md b/agdb_api/php/docs/Model/ServerDatabaseResource.md new file mode 100644 index 00000000..9f3d241f --- /dev/null +++ b/agdb_api/php/docs/Model/ServerDatabaseResource.md @@ -0,0 +1,9 @@ +# # ServerDatabaseResource + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**resource** | [**\Agnesoft\AgdbApi\Model\DbResource**](DbResource.md) | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/UserCredentials.md b/agdb_api/php/docs/Model/UserCredentials.md new file mode 100644 index 00000000..97407933 --- /dev/null +++ b/agdb_api/php/docs/Model/UserCredentials.md @@ -0,0 +1,9 @@ +# # UserCredentials + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**password** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/UserLogin.md b/agdb_api/php/docs/Model/UserLogin.md new file mode 100644 index 00000000..5629c753 --- /dev/null +++ b/agdb_api/php/docs/Model/UserLogin.md @@ -0,0 +1,10 @@ +# # UserLogin + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**password** | **string** | | +**username** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/docs/Model/UserStatus.md b/agdb_api/php/docs/Model/UserStatus.md new file mode 100644 index 00000000..6da5bce1 --- /dev/null +++ b/agdb_api/php/docs/Model/UserStatus.md @@ -0,0 +1,11 @@ +# # UserStatus + +## Properties + +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**admin** | **bool** | | +**login** | **bool** | | +**name** | **string** | | + +[[Back to Model list]](../../README.md#models) [[Back to API list]](../../README.md#endpoints) [[Back to README]](../../README.md) diff --git a/agdb_api/php/lib/Api/AgdbApi.php b/agdb_api/php/lib/Api/AgdbApi.php new file mode 100644 index 00000000..0c8a57d0 --- /dev/null +++ b/agdb_api/php/lib/Api/AgdbApi.php @@ -0,0 +1,12312 @@ + [ + 'application/json', + ], + 'adminDbAudit' => [ + 'application/json', + ], + 'adminDbBackup' => [ + 'application/json', + ], + 'adminDbClear' => [ + 'application/json', + ], + 'adminDbConvert' => [ + 'application/json', + ], + 'adminDbCopy' => [ + 'application/json', + ], + 'adminDbDelete' => [ + 'application/json', + ], + 'adminDbExec' => [ + 'application/json', + ], + 'adminDbList' => [ + 'application/json', + ], + 'adminDbOptimize' => [ + 'application/json', + ], + 'adminDbRemove' => [ + 'application/json', + ], + 'adminDbRename' => [ + 'application/json', + ], + 'adminDbRestore' => [ + 'application/json', + ], + 'adminDbUserAdd' => [ + 'application/json', + ], + 'adminDbUserList' => [ + 'application/json', + ], + 'adminDbUserRemove' => [ + 'application/json', + ], + 'adminShutdown' => [ + 'application/json', + ], + 'adminStatus' => [ + 'application/json', + ], + 'adminUserAdd' => [ + 'application/json', + ], + 'adminUserChangePassword' => [ + 'application/json', + ], + 'adminUserList' => [ + 'application/json', + ], + 'adminUserLogout' => [ + 'application/json', + ], + 'adminUserRemove' => [ + 'application/json', + ], + 'clusterStatus' => [ + 'application/json', + ], + 'dbAdd' => [ + 'application/json', + ], + 'dbAudit' => [ + 'application/json', + ], + 'dbBackup' => [ + 'application/json', + ], + 'dbClear' => [ + 'application/json', + ], + 'dbConvert' => [ + 'application/json', + ], + 'dbCopy' => [ + 'application/json', + ], + 'dbDelete' => [ + 'application/json', + ], + 'dbExec' => [ + 'application/json', + ], + 'dbList' => [ + 'application/json', + ], + 'dbOptimize' => [ + 'application/json', + ], + 'dbRemove' => [ + 'application/json', + ], + 'dbRename' => [ + 'application/json', + ], + 'dbRestore' => [ + 'application/json', + ], + 'dbUserAdd' => [ + 'application/json', + ], + 'dbUserList' => [ + 'application/json', + ], + 'dbUserRemove' => [ + 'application/json', + ], + 'status' => [ + 'application/json', + ], + 'userChangePassword' => [ + 'application/json', + ], + 'userLogin' => [ + 'application/json', + ], + 'userLogout' => [ + 'application/json', + ], + 'userStatus' => [ + 'application/json', + ], + ]; + + /** + * @param ClientInterface $client + * @param Configuration $config + * @param HeaderSelector $selector + * @param int $hostIndex (Optional) host index to select the list of hosts if defined in the OpenAPI spec + */ + public function __construct( + ClientInterface $client = null, + Configuration $config = null, + HeaderSelector $selector = null, + $hostIndex = 0 + ) { + $this->client = $client ?: new Client(); + $this->config = $config ?: Configuration::getDefaultConfiguration(); + $this->headerSelector = $selector ?: new HeaderSelector(); + $this->hostIndex = $hostIndex; + } + + /** + * Set the host index + * + * @param int $hostIndex Host index (required) + */ + public function setHostIndex($hostIndex): void + { + $this->hostIndex = $hostIndex; + } + + /** + * Get the host index + * + * @return int Host index + */ + public function getHostIndex() + { + return $this->hostIndex; + } + + /** + * @return Configuration + */ + public function getConfig() + { + return $this->config; + } + + /** + * Operation adminDbAdd + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbAdd($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) + { + $this->adminDbAddWithHttpInfo($owner, $db, $db_type, $contentType); + } + + /** + * Operation adminDbAddWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbAddWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) + { + $request = $this->adminDbAddRequest($owner, $db, $db_type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbAddAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbAddAsync($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) + { + return $this->adminDbAddAsyncWithHttpInfo($owner, $db, $db_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbAddAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbAddAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) + { + $returnType = ''; + $request = $this->adminDbAddRequest($owner, $db, $db_type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbAdd' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbAddRequest($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbAdd'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbAdd' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbAdd' + ); + } + + // verify the required parameter 'db_type' is set + if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db_type when calling adminDbAdd' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/add'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $db_type, + 'db_type', // param base name + 'DbType', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbAudit + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\QueryAudit[] + */ + public function adminDbAudit($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) + { + list($response) = $this->adminDbAuditWithHttpInfo($owner, $db, $contentType); + return $response; + } + + /** + * Operation adminDbAuditWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\QueryAudit[], HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbAuditWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) + { + $request = $this->adminDbAuditRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryAudit[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\QueryAudit[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminDbAuditAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbAuditAsync($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) + { + return $this->adminDbAuditAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbAuditAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbAuditAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; + $request = $this->adminDbAuditRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbAudit' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbAudit'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbAuditRequest($owner, $db, string $contentType = self::contentTypes['adminDbAudit'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbAudit' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbAudit' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/audit'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbBackup + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbBackup($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) + { + $this->adminDbBackupWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation adminDbBackupWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbBackupWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) + { + $request = $this->adminDbBackupRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbBackupAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbBackupAsync($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) + { + return $this->adminDbBackupAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbBackupAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbBackupAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) + { + $returnType = ''; + $request = $this->adminDbBackupRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbBackup' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbBackup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbBackupRequest($owner, $db, string $contentType = self::contentTypes['adminDbBackup'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbBackup' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbBackup' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/backup'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbClear + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbClear'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\ServerDatabase + */ + public function adminDbClear($owner, $db, $resource, string $contentType = self::contentTypes['adminDbClear'][0]) + { + list($response) = $this->adminDbClearWithHttpInfo($owner, $db, $resource, $contentType); + return $response; + } + + /** + * Operation adminDbClearWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbClear'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbClearWithHttpInfo($owner, $db, $resource, string $contentType = self::contentTypes['adminDbClear'][0]) + { + $request = $this->adminDbClearRequest($owner, $db, $resource, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\ServerDatabase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminDbClearAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbClear'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbClearAsync($owner, $db, $resource, string $contentType = self::contentTypes['adminDbClear'][0]) + { + return $this->adminDbClearAsyncWithHttpInfo($owner, $db, $resource, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbClearAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbClear'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbClearAsyncWithHttpInfo($owner, $db, $resource, string $contentType = self::contentTypes['adminDbClear'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + $request = $this->adminDbClearRequest($owner, $db, $resource, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbClear' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbClear'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbClearRequest($owner, $db, $resource, string $contentType = self::contentTypes['adminDbClear'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbClear' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbClear' + ); + } + + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resource when calling adminDbClear' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/clear'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $resource, + 'resource', // param base name + 'DbResource', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbConvert + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbConvert($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) + { + $this->adminDbConvertWithHttpInfo($owner, $db, $db_type, $contentType); + } + + /** + * Operation adminDbConvertWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbConvertWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) + { + $request = $this->adminDbConvertRequest($owner, $db, $db_type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbConvertAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbConvertAsync($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) + { + return $this->adminDbConvertAsyncWithHttpInfo($owner, $db, $db_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbConvertAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbConvertAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) + { + $returnType = ''; + $request = $this->adminDbConvertRequest($owner, $db, $db_type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbConvert' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbConvert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbConvertRequest($owner, $db, $db_type, string $contentType = self::contentTypes['adminDbConvert'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbConvert' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbConvert' + ); + } + + // verify the required parameter 'db_type' is set + if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db_type when calling adminDbConvert' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/convert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $db_type, + 'db_type', // param base name + 'DbType', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbCopy + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbCopy($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) + { + $this->adminDbCopyWithHttpInfo($owner, $db, $new_name, $contentType); + } + + /** + * Operation adminDbCopyWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbCopyWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) + { + $request = $this->adminDbCopyRequest($owner, $db, $new_name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbCopyAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbCopyAsync($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) + { + return $this->adminDbCopyAsyncWithHttpInfo($owner, $db, $new_name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbCopyAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbCopyAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) + { + $returnType = ''; + $request = $this->adminDbCopyRequest($owner, $db, $new_name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbCopy' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbCopyRequest($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbCopy'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbCopy' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbCopy' + ); + } + + // verify the required parameter 'new_name' is set + if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $new_name when calling adminDbCopy' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/copy'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $new_name, + 'new_name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbDelete + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbDelete($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) + { + $this->adminDbDeleteWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation adminDbDeleteWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbDeleteWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) + { + $request = $this->adminDbDeleteRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbDeleteAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbDeleteAsync($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) + { + return $this->adminDbDeleteAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbDeleteAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbDeleteAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) + { + $returnType = ''; + $request = $this->adminDbDeleteRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbDelete' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbDeleteRequest($owner, $db, string $contentType = self::contentTypes['adminDbDelete'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbDelete' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbDelete' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/delete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbExec + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\QueryResult[] + */ + public function adminDbExec($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) + { + list($response) = $this->adminDbExecWithHttpInfo($owner, $db, $query_type, $contentType); + return $response; + } + + /** + * Operation adminDbExecWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\QueryResult[], HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbExecWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) + { + $request = $this->adminDbExecRequest($owner, $db, $query_type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\QueryResult[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\QueryResult[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryResult[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\QueryResult[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminDbExecAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbExecAsync($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) + { + return $this->adminDbExecAsyncWithHttpInfo($owner, $db, $query_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbExecAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbExecAsyncWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; + $request = $this->adminDbExecRequest($owner, $db, $query_type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbExec' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbExec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbExecRequest($owner, $db, $query_type, string $contentType = self::contentTypes['adminDbExec'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbExec' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbExec' + ); + } + + // verify the required parameter 'query_type' is set + if ($query_type === null || (is_array($query_type) && count($query_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $query_type when calling adminDbExec' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/exec'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($query_type)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($query_type)); + } else { + $httpBody = $query_type; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbList + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\ServerDatabase[] + */ + public function adminDbList(string $contentType = self::contentTypes['adminDbList'][0]) + { + list($response) = $this->adminDbListWithHttpInfo($contentType); + return $response; + } + + /** + * Operation adminDbListWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase[], HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbListWithHttpInfo(string $contentType = self::contentTypes['adminDbList'][0]) + { + $request = $this->adminDbListRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\ServerDatabase[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminDbListAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbListAsync(string $contentType = self::contentTypes['adminDbList'][0]) + { + return $this->adminDbListAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbListAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbListAsyncWithHttpInfo(string $contentType = self::contentTypes['adminDbList'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; + $request = $this->adminDbListRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbList' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbListRequest(string $contentType = self::contentTypes['adminDbList'][0]) + { + + + $resourcePath = '/api/v1/admin/db/list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbOptimize + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\ServerDatabase + */ + public function adminDbOptimize($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) + { + list($response) = $this->adminDbOptimizeWithHttpInfo($owner, $db, $contentType); + return $response; + } + + /** + * Operation adminDbOptimizeWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbOptimizeWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) + { + $request = $this->adminDbOptimizeRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\ServerDatabase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminDbOptimizeAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbOptimizeAsync($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) + { + return $this->adminDbOptimizeAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbOptimizeAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbOptimizeAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + $request = $this->adminDbOptimizeRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbOptimize' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbOptimize'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbOptimizeRequest($owner, $db, string $contentType = self::contentTypes['adminDbOptimize'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbOptimize' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbOptimize' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/optimize'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbRemove + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbRemove($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) + { + $this->adminDbRemoveWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation adminDbRemoveWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbRemoveWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) + { + $request = $this->adminDbRemoveRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbRemoveAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbRemoveAsync($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) + { + return $this->adminDbRemoveAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbRemoveAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbRemoveAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) + { + $returnType = ''; + $request = $this->adminDbRemoveRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbRemove' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbRemoveRequest($owner, $db, string $contentType = self::contentTypes['adminDbRemove'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbRemove' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbRemove' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/remove'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbRename + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbRename($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) + { + $this->adminDbRenameWithHttpInfo($owner, $db, $new_name, $contentType); + } + + /** + * Operation adminDbRenameWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbRenameWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) + { + $request = $this->adminDbRenameRequest($owner, $db, $new_name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbRenameAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbRenameAsync($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) + { + return $this->adminDbRenameAsyncWithHttpInfo($owner, $db, $new_name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbRenameAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbRenameAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) + { + $returnType = ''; + $request = $this->adminDbRenameRequest($owner, $db, $new_name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbRename' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRename'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbRenameRequest($owner, $db, $new_name, string $contentType = self::contentTypes['adminDbRename'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbRename' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbRename' + ); + } + + // verify the required parameter 'new_name' is set + if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $new_name when calling adminDbRename' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/rename'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $new_name, + 'new_name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbRestore + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbRestore($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) + { + $this->adminDbRestoreWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation adminDbRestoreWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbRestoreWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) + { + $request = $this->adminDbRestoreRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbRestoreAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbRestoreAsync($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) + { + return $this->adminDbRestoreAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbRestoreAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbRestoreAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) + { + $returnType = ''; + $request = $this->adminDbRestoreRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbRestore' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbRestore'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbRestoreRequest($owner, $db, string $contentType = self::contentTypes['adminDbRestore'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbRestore' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbRestore' + ); + } + + + $resourcePath = '/api/v1/db/admin/{owner}/{db}/restore'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbUserAdd + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbUserAdd($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) + { + $this->adminDbUserAddWithHttpInfo($owner, $db, $username, $db_role, $contentType); + } + + /** + * Operation adminDbUserAddWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbUserAddWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) + { + $request = $this->adminDbUserAddRequest($owner, $db, $username, $db_role, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbUserAddAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbUserAddAsync($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) + { + return $this->adminDbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbUserAddAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) + { + $returnType = ''; + $request = $this->adminDbUserAddRequest($owner, $db, $username, $db_role, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbUserAdd' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbUserAddRequest($owner, $db, $username, $db_role, string $contentType = self::contentTypes['adminDbUserAdd'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbUserAdd' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbUserAdd' + ); + } + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling adminDbUserAdd' + ); + } + + // verify the required parameter 'db_role' is set + if ($db_role === null || (is_array($db_role) && count($db_role) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db_role when calling adminDbUserAdd' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/user/{username}/add'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $db_role, + 'db_role', // param base name + 'DbUserRole', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbUserList + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\DbUser[] + */ + public function adminDbUserList($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) + { + list($response) = $this->adminDbUserListWithHttpInfo($owner, $db, $contentType); + return $response; + } + + /** + * Operation adminDbUserListWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\DbUser[], HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbUserListWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) + { + $request = $this->adminDbUserListRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\DbUser[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\DbUser[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\DbUser[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\DbUser[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminDbUserListAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbUserListAsync($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) + { + return $this->adminDbUserListAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbUserListAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbUserListAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; + $request = $this->adminDbUserListRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbUserList' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbUserListRequest($owner, $db, string $contentType = self::contentTypes['adminDbUserList'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbUserList' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbUserList' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/user/list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminDbUserRemove + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminDbUserRemove($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) + { + $this->adminDbUserRemoveWithHttpInfo($owner, $db, $username, $contentType); + } + + /** + * Operation adminDbUserRemoveWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminDbUserRemoveWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) + { + $request = $this->adminDbUserRemoveRequest($owner, $db, $username, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminDbUserRemoveAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbUserRemoveAsync($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) + { + return $this->adminDbUserRemoveAsyncWithHttpInfo($owner, $db, $username, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminDbUserRemoveAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminDbUserRemoveAsyncWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) + { + $returnType = ''; + $request = $this->adminDbUserRemoveRequest($owner, $db, $username, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminDbUserRemove' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminDbUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminDbUserRemoveRequest($owner, $db, $username, string $contentType = self::contentTypes['adminDbUserRemove'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling adminDbUserRemove' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling adminDbUserRemove' + ); + } + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling adminDbUserRemove' + ); + } + + + $resourcePath = '/api/v1/admin/db/{owner}/{db}/user/{username}/remove'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminShutdown + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminShutdown(string $contentType = self::contentTypes['adminShutdown'][0]) + { + $this->adminShutdownWithHttpInfo($contentType); + } + + /** + * Operation adminShutdownWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminShutdownWithHttpInfo(string $contentType = self::contentTypes['adminShutdown'][0]) + { + $request = $this->adminShutdownRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminShutdownAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminShutdownAsync(string $contentType = self::contentTypes['adminShutdown'][0]) + { + return $this->adminShutdownAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminShutdownAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminShutdownAsyncWithHttpInfo(string $contentType = self::contentTypes['adminShutdown'][0]) + { + $returnType = ''; + $request = $this->adminShutdownRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminShutdown' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminShutdown'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminShutdownRequest(string $contentType = self::contentTypes['adminShutdown'][0]) + { + + + $resourcePath = '/api/v1/admin/shutdown'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminStatus + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\AdminStatus + */ + public function adminStatus(string $contentType = self::contentTypes['adminStatus'][0]) + { + list($response) = $this->adminStatusWithHttpInfo($contentType); + return $response; + } + + /** + * Operation adminStatusWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\AdminStatus, HTTP status code, HTTP response headers (array of strings) + */ + public function adminStatusWithHttpInfo(string $contentType = self::contentTypes['adminStatus'][0]) + { + $request = $this->adminStatusRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\AdminStatus' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\AdminStatus' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\AdminStatus', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\AdminStatus'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\AdminStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminStatusAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminStatusAsync(string $contentType = self::contentTypes['adminStatus'][0]) + { + return $this->adminStatusAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminStatusAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['adminStatus'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\AdminStatus'; + $request = $this->adminStatusRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminStatus' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminStatusRequest(string $contentType = self::contentTypes['adminStatus'][0]) + { + + + $resourcePath = '/api/v1/admin/status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminUserAdd + * + * @param string $username desired user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminUserAdd($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) + { + $this->adminUserAddWithHttpInfo($username, $user_credentials, $contentType); + } + + /** + * Operation adminUserAddWithHttpInfo + * + * @param string $username desired user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminUserAddWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) + { + $request = $this->adminUserAddRequest($username, $user_credentials, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminUserAddAsync + * + * @param string $username desired user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserAddAsync($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) + { + return $this->adminUserAddAsyncWithHttpInfo($username, $user_credentials, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminUserAddAsyncWithHttpInfo + * + * @param string $username desired user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserAddAsyncWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) + { + $returnType = ''; + $request = $this->adminUserAddRequest($username, $user_credentials, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminUserAdd' + * + * @param string $username desired user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminUserAddRequest($username, $user_credentials, string $contentType = self::contentTypes['adminUserAdd'][0]) + { + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling adminUserAdd' + ); + } + + // verify the required parameter 'user_credentials' is set + if ($user_credentials === null || (is_array($user_credentials) && count($user_credentials) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_credentials when calling adminUserAdd' + ); + } + + + $resourcePath = '/api/v1/admin/user/{username}/add'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($user_credentials)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_credentials)); + } else { + $httpBody = $user_credentials; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminUserChangePassword + * + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminUserChangePassword($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) + { + $this->adminUserChangePasswordWithHttpInfo($username, $user_credentials, $contentType); + } + + /** + * Operation adminUserChangePasswordWithHttpInfo + * + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminUserChangePasswordWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) + { + $request = $this->adminUserChangePasswordRequest($username, $user_credentials, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminUserChangePasswordAsync + * + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserChangePasswordAsync($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) + { + return $this->adminUserChangePasswordAsyncWithHttpInfo($username, $user_credentials, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminUserChangePasswordAsyncWithHttpInfo + * + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserChangePasswordAsyncWithHttpInfo($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) + { + $returnType = ''; + $request = $this->adminUserChangePasswordRequest($username, $user_credentials, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminUserChangePassword' + * + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\UserCredentials $user_credentials (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserChangePassword'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminUserChangePasswordRequest($username, $user_credentials, string $contentType = self::contentTypes['adminUserChangePassword'][0]) + { + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling adminUserChangePassword' + ); + } + + // verify the required parameter 'user_credentials' is set + if ($user_credentials === null || (is_array($user_credentials) && count($user_credentials) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_credentials when calling adminUserChangePassword' + ); + } + + + $resourcePath = '/api/v1/admin/user/{username}/change_password'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($user_credentials)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_credentials)); + } else { + $httpBody = $user_credentials; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminUserList + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\UserStatus[] + */ + public function adminUserList(string $contentType = self::contentTypes['adminUserList'][0]) + { + list($response) = $this->adminUserListWithHttpInfo($contentType); + return $response; + } + + /** + * Operation adminUserListWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\UserStatus[], HTTP status code, HTTP response headers (array of strings) + */ + public function adminUserListWithHttpInfo(string $contentType = self::contentTypes['adminUserList'][0]) + { + $request = $this->adminUserListRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\UserStatus[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\UserStatus[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\UserStatus[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\UserStatus[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminUserListAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserListAsync(string $contentType = self::contentTypes['adminUserList'][0]) + { + return $this->adminUserListAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminUserListAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserListAsyncWithHttpInfo(string $contentType = self::contentTypes['adminUserList'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; + $request = $this->adminUserListRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminUserList' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminUserListRequest(string $contentType = self::contentTypes['adminUserList'][0]) + { + + + $resourcePath = '/api/v1/admin/user/list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminUserLogout + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function adminUserLogout($username, string $contentType = self::contentTypes['adminUserLogout'][0]) + { + $this->adminUserLogoutWithHttpInfo($username, $contentType); + } + + /** + * Operation adminUserLogoutWithHttpInfo + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function adminUserLogoutWithHttpInfo($username, string $contentType = self::contentTypes['adminUserLogout'][0]) + { + $request = $this->adminUserLogoutRequest($username, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation adminUserLogoutAsync + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserLogoutAsync($username, string $contentType = self::contentTypes['adminUserLogout'][0]) + { + return $this->adminUserLogoutAsyncWithHttpInfo($username, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminUserLogoutAsyncWithHttpInfo + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserLogoutAsyncWithHttpInfo($username, string $contentType = self::contentTypes['adminUserLogout'][0]) + { + $returnType = ''; + $request = $this->adminUserLogoutRequest($username, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminUserLogout' + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserLogout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminUserLogoutRequest($username, string $contentType = self::contentTypes['adminUserLogout'][0]) + { + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling adminUserLogout' + ); + } + + + $resourcePath = '/api/v1/admin/user/{username}/logout'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation adminUserRemove + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\UserStatus[] + */ + public function adminUserRemove($username, string $contentType = self::contentTypes['adminUserRemove'][0]) + { + list($response) = $this->adminUserRemoveWithHttpInfo($username, $contentType); + return $response; + } + + /** + * Operation adminUserRemoveWithHttpInfo + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\UserStatus[], HTTP status code, HTTP response headers (array of strings) + */ + public function adminUserRemoveWithHttpInfo($username, string $contentType = self::contentTypes['adminUserRemove'][0]) + { + $request = $this->adminUserRemoveRequest($username, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 204: + if ('\Agnesoft\AgdbApi\Model\UserStatus[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\UserStatus[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\UserStatus[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 204: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\UserStatus[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation adminUserRemoveAsync + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserRemoveAsync($username, string $contentType = self::contentTypes['adminUserRemove'][0]) + { + return $this->adminUserRemoveAsyncWithHttpInfo($username, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation adminUserRemoveAsyncWithHttpInfo + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function adminUserRemoveAsyncWithHttpInfo($username, string $contentType = self::contentTypes['adminUserRemove'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\UserStatus[]'; + $request = $this->adminUserRemoveRequest($username, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'adminUserRemove' + * + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['adminUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function adminUserRemoveRequest($username, string $contentType = self::contentTypes['adminUserRemove'][0]) + { + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling adminUserRemove' + ); + } + + + $resourcePath = '/api/v1/admin/user/{username}/remove'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation clusterStatus + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\ClusterStatus[] + */ + public function clusterStatus(string $contentType = self::contentTypes['clusterStatus'][0]) + { + list($response) = $this->clusterStatusWithHttpInfo($contentType); + return $response; + } + + /** + * Operation clusterStatusWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\ClusterStatus[], HTTP status code, HTTP response headers (array of strings) + */ + public function clusterStatusWithHttpInfo(string $contentType = self::contentTypes['clusterStatus'][0]) + { + $request = $this->clusterStatusRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\ClusterStatus[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\ClusterStatus[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ClusterStatus[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\ClusterStatus[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\ClusterStatus[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation clusterStatusAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function clusterStatusAsync(string $contentType = self::contentTypes['clusterStatus'][0]) + { + return $this->clusterStatusAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation clusterStatusAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function clusterStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['clusterStatus'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\ClusterStatus[]'; + $request = $this->clusterStatusRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'clusterStatus' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['clusterStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function clusterStatusRequest(string $contentType = self::contentTypes['clusterStatus'][0]) + { + + + $resourcePath = '/api/v1/cluster/status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbAdd + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbAdd($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) + { + $this->dbAddWithHttpInfo($owner, $db, $db_type, $contentType); + } + + /** + * Operation dbAddWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbAddWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) + { + $request = $this->dbAddRequest($owner, $db, $db_type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbAddAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbAddAsync($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) + { + return $this->dbAddAsyncWithHttpInfo($owner, $db, $db_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbAddAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbAddAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) + { + $returnType = ''; + $request = $this->dbAddRequest($owner, $db, $db_type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbAdd' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbAddRequest($owner, $db, $db_type, string $contentType = self::contentTypes['dbAdd'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbAdd' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbAdd' + ); + } + + // verify the required parameter 'db_type' is set + if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db_type when calling dbAdd' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/add'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $db_type, + 'db_type', // param base name + 'DbType', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbAudit + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\QueryAudit[] + */ + public function dbAudit($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) + { + list($response) = $this->dbAuditWithHttpInfo($owner, $db, $contentType); + return $response; + } + + /** + * Operation dbAuditWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\QueryAudit[], HTTP status code, HTTP response headers (array of strings) + */ + public function dbAuditWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) + { + $request = $this->dbAuditRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\QueryAudit[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryAudit[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\QueryAudit[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation dbAuditAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbAuditAsync($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) + { + return $this->dbAuditAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbAuditAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbAuditAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\QueryAudit[]'; + $request = $this->dbAuditRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbAudit' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbAudit'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbAuditRequest($owner, $db, string $contentType = self::contentTypes['dbAudit'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbAudit' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbAudit' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/audit'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbBackup + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbBackup($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) + { + $this->dbBackupWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation dbBackupWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbBackupWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) + { + $request = $this->dbBackupRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbBackupAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbBackupAsync($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) + { + return $this->dbBackupAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbBackupAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbBackupAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) + { + $returnType = ''; + $request = $this->dbBackupRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbBackup' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbBackup'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbBackupRequest($owner, $db, string $contentType = self::contentTypes['dbBackup'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbBackup' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbBackup' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/backup'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbClear + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\ServerDatabase + */ + public function dbClear($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) + { + list($response) = $this->dbClearWithHttpInfo($owner, $db, $resource, $contentType); + return $response; + } + + /** + * Operation dbClearWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase, HTTP status code, HTTP response headers (array of strings) + */ + public function dbClearWithHttpInfo($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) + { + $request = $this->dbClearRequest($owner, $db, $resource, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 201: + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 201: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\ServerDatabase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation dbClearAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbClearAsync($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) + { + return $this->dbClearAsyncWithHttpInfo($owner, $db, $resource, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbClearAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbClearAsyncWithHttpInfo($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + $request = $this->dbClearRequest($owner, $db, $resource, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbClear' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbResource $resource (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbClear'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbClearRequest($owner, $db, $resource, string $contentType = self::contentTypes['dbClear'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbClear' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbClear' + ); + } + + // verify the required parameter 'resource' is set + if ($resource === null || (is_array($resource) && count($resource) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $resource when calling dbClear' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/clear'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $resource, + 'resource', // param base name + 'DbResource', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbConvert + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbConvert($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) + { + $this->dbConvertWithHttpInfo($owner, $db, $db_type, $contentType); + } + + /** + * Operation dbConvertWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbConvertWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) + { + $request = $this->dbConvertRequest($owner, $db, $db_type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbConvertAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbConvertAsync($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) + { + return $this->dbConvertAsyncWithHttpInfo($owner, $db, $db_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbConvertAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbConvertAsyncWithHttpInfo($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) + { + $returnType = ''; + $request = $this->dbConvertRequest($owner, $db, $db_type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbConvert' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\DbType $db_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbConvert'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbConvertRequest($owner, $db, $db_type, string $contentType = self::contentTypes['dbConvert'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbConvert' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbConvert' + ); + } + + // verify the required parameter 'db_type' is set + if ($db_type === null || (is_array($db_type) && count($db_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db_type when calling dbConvert' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/convert'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $db_type, + 'db_type', // param base name + 'DbType', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbCopy + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbCopy($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) + { + $this->dbCopyWithHttpInfo($owner, $db, $new_name, $contentType); + } + + /** + * Operation dbCopyWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbCopyWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) + { + $request = $this->dbCopyRequest($owner, $db, $new_name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbCopyAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbCopyAsync($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) + { + return $this->dbCopyAsyncWithHttpInfo($owner, $db, $new_name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbCopyAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbCopyAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) + { + $returnType = ''; + $request = $this->dbCopyRequest($owner, $db, $new_name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbCopy' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbCopy'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbCopyRequest($owner, $db, $new_name, string $contentType = self::contentTypes['dbCopy'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbCopy' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbCopy' + ); + } + + // verify the required parameter 'new_name' is set + if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $new_name when calling dbCopy' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/copy'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $new_name, + 'new_name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbDelete + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbDelete($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) + { + $this->dbDeleteWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation dbDeleteWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbDeleteWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) + { + $request = $this->dbDeleteRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbDeleteAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbDeleteAsync($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) + { + return $this->dbDeleteAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbDeleteAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbDeleteAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) + { + $returnType = ''; + $request = $this->dbDeleteRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbDelete' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbDelete'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbDeleteRequest($owner, $db, string $contentType = self::contentTypes['dbDelete'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbDelete' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbDelete' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/delete'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbExec + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\QueryResult[] + */ + public function dbExec($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) + { + list($response) = $this->dbExecWithHttpInfo($owner, $db, $query_type, $contentType); + return $response; + } + + /** + * Operation dbExecWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\QueryResult[], HTTP status code, HTTP response headers (array of strings) + */ + public function dbExecWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) + { + $request = $this->dbExecRequest($owner, $db, $query_type, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\QueryResult[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\QueryResult[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\QueryResult[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\QueryResult[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation dbExecAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbExecAsync($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) + { + return $this->dbExecAsyncWithHttpInfo($owner, $db, $query_type, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbExecAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbExecAsyncWithHttpInfo($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\QueryResult[]'; + $request = $this->dbExecRequest($owner, $db, $query_type, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbExec' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param \Agnesoft\AgdbApi\Model\QueryType[] $query_type (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbExec'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbExecRequest($owner, $db, $query_type, string $contentType = self::contentTypes['dbExec'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbExec' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbExec' + ); + } + + // verify the required parameter 'query_type' is set + if ($query_type === null || (is_array($query_type) && count($query_type) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $query_type when calling dbExec' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/exec'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($query_type)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($query_type)); + } else { + $httpBody = $query_type; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbList + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\ServerDatabase[] + */ + public function dbList(string $contentType = self::contentTypes['dbList'][0]) + { + list($response) = $this->dbListWithHttpInfo($contentType); + return $response; + } + + /** + * Operation dbListWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase[], HTTP status code, HTTP response headers (array of strings) + */ + public function dbListWithHttpInfo(string $contentType = self::contentTypes['dbList'][0]) + { + $request = $this->dbListRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\ServerDatabase[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\ServerDatabase[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation dbListAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbListAsync(string $contentType = self::contentTypes['dbList'][0]) + { + return $this->dbListAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbListAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbListAsyncWithHttpInfo(string $contentType = self::contentTypes['dbList'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase[]'; + $request = $this->dbListRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbList' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbListRequest(string $contentType = self::contentTypes['dbList'][0]) + { + + + $resourcePath = '/api/v1/db/list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbOptimize + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\ServerDatabase + */ + public function dbOptimize($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) + { + list($response) = $this->dbOptimizeWithHttpInfo($owner, $db, $contentType); + return $response; + } + + /** + * Operation dbOptimizeWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\ServerDatabase, HTTP status code, HTTP response headers (array of strings) + */ + public function dbOptimizeWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) + { + $request = $this->dbOptimizeRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\ServerDatabase' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\ServerDatabase', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\ServerDatabase', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation dbOptimizeAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbOptimizeAsync($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) + { + return $this->dbOptimizeAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbOptimizeAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbOptimizeAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\ServerDatabase'; + $request = $this->dbOptimizeRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbOptimize' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbOptimize'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbOptimizeRequest($owner, $db, string $contentType = self::contentTypes['dbOptimize'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbOptimize' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbOptimize' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/optimize'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbRemove + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbRemove($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) + { + $this->dbRemoveWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation dbRemoveWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbRemoveWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) + { + $request = $this->dbRemoveRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbRemoveAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbRemoveAsync($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) + { + return $this->dbRemoveAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbRemoveAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbRemoveAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) + { + $returnType = ''; + $request = $this->dbRemoveRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbRemove' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbRemoveRequest($owner, $db, string $contentType = self::contentTypes['dbRemove'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbRemove' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbRemove' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/remove'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'DELETE', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbRename + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbRename($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) + { + $this->dbRenameWithHttpInfo($owner, $db, $new_name, $contentType); + } + + /** + * Operation dbRenameWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbRenameWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) + { + $request = $this->dbRenameRequest($owner, $db, $new_name, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbRenameAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbRenameAsync($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) + { + return $this->dbRenameAsyncWithHttpInfo($owner, $db, $new_name, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbRenameAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbRenameAsyncWithHttpInfo($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) + { + $returnType = ''; + $request = $this->dbRenameRequest($owner, $db, $new_name, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbRename' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $new_name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRename'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbRenameRequest($owner, $db, $new_name, string $contentType = self::contentTypes['dbRename'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbRename' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbRename' + ); + } + + // verify the required parameter 'new_name' is set + if ($new_name === null || (is_array($new_name) && count($new_name) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $new_name when calling dbRename' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/rename'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $new_name, + 'new_name', // param base name + 'string', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbRestore + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbRestore($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) + { + $this->dbRestoreWithHttpInfo($owner, $db, $contentType); + } + + /** + * Operation dbRestoreWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbRestoreWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) + { + $request = $this->dbRestoreRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbRestoreAsync + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbRestoreAsync($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) + { + return $this->dbRestoreAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbRestoreAsyncWithHttpInfo + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbRestoreAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) + { + $returnType = ''; + $request = $this->dbRestoreRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbRestore' + * + * @param string $owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbRestore'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbRestoreRequest($owner, $db, string $contentType = self::contentTypes['dbRestore'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbRestore' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbRestore' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/restore'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbUserAdd + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbUserAdd($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) + { + $this->dbUserAddWithHttpInfo($owner, $db, $username, $db_role, $contentType); + } + + /** + * Operation dbUserAddWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbUserAddWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) + { + $request = $this->dbUserAddRequest($owner, $db, $username, $db_role, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbUserAddAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbUserAddAsync($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) + { + return $this->dbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbUserAddAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbUserAddAsyncWithHttpInfo($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) + { + $returnType = ''; + $request = $this->dbUserAddRequest($owner, $db, $username, $db_role, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbUserAdd' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserAdd'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbUserAddRequest($owner, $db, $username, $db_role, string $contentType = self::contentTypes['dbUserAdd'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbUserAdd' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbUserAdd' + ); + } + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling dbUserAdd' + ); + } + + // verify the required parameter 'db_role' is set + if ($db_role === null || (is_array($db_role) && count($db_role) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db_role when calling dbUserAdd' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/user/{username}/add'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + // query params + $queryParams = array_merge($queryParams, ObjectSerializer::toQueryValue( + $db_role, + 'db_role', // param base name + 'DbUserRole', // openApiType + 'form', // style + true, // explode + true // required + ) ?? []); + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbUserList + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\DbUser[] + */ + public function dbUserList($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) + { + list($response) = $this->dbUserListWithHttpInfo($owner, $db, $contentType); + return $response; + } + + /** + * Operation dbUserListWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\DbUser[], HTTP status code, HTTP response headers (array of strings) + */ + public function dbUserListWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) + { + $request = $this->dbUserListRequest($owner, $db, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\DbUser[]' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\DbUser[]' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\DbUser[]', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\DbUser[]', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation dbUserListAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbUserListAsync($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) + { + return $this->dbUserListAsyncWithHttpInfo($owner, $db, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbUserListAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbUserListAsyncWithHttpInfo($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\DbUser[]'; + $request = $this->dbUserListRequest($owner, $db, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbUserList' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserList'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbUserListRequest($owner, $db, string $contentType = self::contentTypes['dbUserList'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbUserList' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbUserList' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/user/list'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation dbUserRemove + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function dbUserRemove($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) + { + $this->dbUserRemoveWithHttpInfo($owner, $db, $username, $contentType); + } + + /** + * Operation dbUserRemoveWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function dbUserRemoveWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) + { + $request = $this->dbUserRemoveRequest($owner, $db, $username, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation dbUserRemoveAsync + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbUserRemoveAsync($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) + { + return $this->dbUserRemoveAsyncWithHttpInfo($owner, $db, $username, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation dbUserRemoveAsyncWithHttpInfo + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function dbUserRemoveAsyncWithHttpInfo($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) + { + $returnType = ''; + $request = $this->dbUserRemoveRequest($owner, $db, $username, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'dbUserRemove' + * + * @param string $owner db owner user name (required) + * @param string $db db name (required) + * @param string $username user name (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['dbUserRemove'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function dbUserRemoveRequest($owner, $db, $username, string $contentType = self::contentTypes['dbUserRemove'][0]) + { + + // verify the required parameter 'owner' is set + if ($owner === null || (is_array($owner) && count($owner) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $owner when calling dbUserRemove' + ); + } + + // verify the required parameter 'db' is set + if ($db === null || (is_array($db) && count($db) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $db when calling dbUserRemove' + ); + } + + // verify the required parameter 'username' is set + if ($username === null || (is_array($username) && count($username) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $username when calling dbUserRemove' + ); + } + + + $resourcePath = '/api/v1/db/{owner}/{db}/user/{username}/remove'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + // path params + if ($owner !== null) { + $resourcePath = str_replace( + '{' . 'owner' . '}', + ObjectSerializer::toPathValue($owner), + $resourcePath + ); + } + // path params + if ($db !== null) { + $resourcePath = str_replace( + '{' . 'db' . '}', + ObjectSerializer::toPathValue($db), + $resourcePath + ); + } + // path params + if ($username !== null) { + $resourcePath = str_replace( + '{' . 'username' . '}', + ObjectSerializer::toPathValue($username), + $resourcePath + ); + } + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation status + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function status(string $contentType = self::contentTypes['status'][0]) + { + $this->statusWithHttpInfo($contentType); + } + + /** + * Operation statusWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function statusWithHttpInfo(string $contentType = self::contentTypes['status'][0]) + { + $request = $this->statusRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation statusAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function statusAsync(string $contentType = self::contentTypes['status'][0]) + { + return $this->statusAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation statusAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function statusAsyncWithHttpInfo(string $contentType = self::contentTypes['status'][0]) + { + $returnType = ''; + $request = $this->statusRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'status' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['status'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function statusRequest(string $contentType = self::contentTypes['status'][0]) + { + + + $resourcePath = '/api/v1/status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation userChangePassword + * + * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password change_password (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function userChangePassword($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) + { + $this->userChangePasswordWithHttpInfo($change_password, $contentType); + } + + /** + * Operation userChangePasswordWithHttpInfo + * + * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function userChangePasswordWithHttpInfo($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) + { + $request = $this->userChangePasswordRequest($change_password, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation userChangePasswordAsync + * + * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userChangePasswordAsync($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) + { + return $this->userChangePasswordAsyncWithHttpInfo($change_password, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation userChangePasswordAsyncWithHttpInfo + * + * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userChangePasswordAsyncWithHttpInfo($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) + { + $returnType = ''; + $request = $this->userChangePasswordRequest($change_password, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'userChangePassword' + * + * @param \Agnesoft\AgdbApi\Model\ChangePassword $change_password (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userChangePassword'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function userChangePasswordRequest($change_password, string $contentType = self::contentTypes['userChangePassword'][0]) + { + + // verify the required parameter 'change_password' is set + if ($change_password === null || (is_array($change_password) && count($change_password) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $change_password when calling userChangePassword' + ); + } + + + $resourcePath = '/api/v1/user/change_password'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($change_password)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($change_password)); + } else { + $httpBody = $change_password; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'PUT', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation userLogin + * + * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login user_login (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return string + */ + public function userLogin($user_login, string $contentType = self::contentTypes['userLogin'][0]) + { + list($response) = $this->userLoginWithHttpInfo($user_login, $contentType); + return $response; + } + + /** + * Operation userLoginWithHttpInfo + * + * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of string, HTTP status code, HTTP response headers (array of strings) + */ + public function userLoginWithHttpInfo($user_login, string $contentType = self::contentTypes['userLogin'][0]) + { + $request = $this->userLoginRequest($user_login, $contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('string' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('string' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, 'string', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = 'string'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + 'string', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation userLoginAsync + * + * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userLoginAsync($user_login, string $contentType = self::contentTypes['userLogin'][0]) + { + return $this->userLoginAsyncWithHttpInfo($user_login, $contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation userLoginAsyncWithHttpInfo + * + * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userLoginAsyncWithHttpInfo($user_login, string $contentType = self::contentTypes['userLogin'][0]) + { + $returnType = 'string'; + $request = $this->userLoginRequest($user_login, $contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'userLogin' + * + * @param \Agnesoft\AgdbApi\Model\UserLogin $user_login (required) + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogin'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function userLoginRequest($user_login, string $contentType = self::contentTypes['userLogin'][0]) + { + + // verify the required parameter 'user_login' is set + if ($user_login === null || (is_array($user_login) && count($user_login) === 0)) { + throw new \InvalidArgumentException( + 'Missing the required parameter $user_login when calling userLogin' + ); + } + + + $resourcePath = '/api/v1/user/login'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['text/plain', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (isset($user_login)) { + if (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the body + $httpBody = \GuzzleHttp\Utils::jsonEncode(ObjectSerializer::sanitizeForSerialization($user_login)); + } else { + $httpBody = $user_login; + } + } elseif (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation userLogout + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return void + */ + public function userLogout(string $contentType = self::contentTypes['userLogout'][0]) + { + $this->userLogoutWithHttpInfo($contentType); + } + + /** + * Operation userLogoutWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of null, HTTP status code, HTTP response headers (array of strings) + */ + public function userLogoutWithHttpInfo(string $contentType = self::contentTypes['userLogout'][0]) + { + $request = $this->userLogoutRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + return [null, $statusCode, $response->getHeaders()]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + } + throw $e; + } + } + + /** + * Operation userLogoutAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userLogoutAsync(string $contentType = self::contentTypes['userLogout'][0]) + { + return $this->userLogoutAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation userLogoutAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userLogoutAsyncWithHttpInfo(string $contentType = self::contentTypes['userLogout'][0]) + { + $returnType = ''; + $request = $this->userLogoutRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + return [null, $response->getStatusCode(), $response->getHeaders()]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'userLogout' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userLogout'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function userLogoutRequest(string $contentType = self::contentTypes['userLogout'][0]) + { + + + $resourcePath = '/api/v1/user/logout'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + [], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'POST', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Operation userStatus + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return \Agnesoft\AgdbApi\Model\UserStatus + */ + public function userStatus(string $contentType = self::contentTypes['userStatus'][0]) + { + list($response) = $this->userStatusWithHttpInfo($contentType); + return $response; + } + + /** + * Operation userStatusWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation + * + * @throws \Agnesoft\AgdbApi\ApiException on non-2xx response or if the response body is not in the expected format + * @throws \InvalidArgumentException + * @return array of \Agnesoft\AgdbApi\Model\UserStatus, HTTP status code, HTTP response headers (array of strings) + */ + public function userStatusWithHttpInfo(string $contentType = self::contentTypes['userStatus'][0]) + { + $request = $this->userStatusRequest($contentType); + + try { + $options = $this->createHttpClientOption(); + try { + $response = $this->client->send($request, $options); + } catch (RequestException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + $e->getResponse() ? $e->getResponse()->getHeaders() : null, + $e->getResponse() ? (string) $e->getResponse()->getBody() : null + ); + } catch (ConnectException $e) { + throw new ApiException( + "[{$e->getCode()}] {$e->getMessage()}", + (int) $e->getCode(), + null, + null + ); + } + + $statusCode = $response->getStatusCode(); + + + switch($statusCode) { + case 200: + if ('\Agnesoft\AgdbApi\Model\UserStatus' === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ('\Agnesoft\AgdbApi\Model\UserStatus' !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, '\Agnesoft\AgdbApi\Model\UserStatus', []), + $response->getStatusCode(), + $response->getHeaders() + ]; + } + + if ($statusCode < 200 || $statusCode > 299) { + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + (string) $request->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + + $returnType = '\Agnesoft\AgdbApi\Model\UserStatus'; + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + try { + $content = json_decode($content, false, 512, JSON_THROW_ON_ERROR); + } catch (\JsonException $exception) { + throw new ApiException( + sprintf( + 'Error JSON decoding server response (%s)', + $request->getUri() + ), + $statusCode, + $response->getHeaders(), + $content + ); + } + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + + } catch (ApiException $e) { + switch ($e->getCode()) { + case 200: + $data = ObjectSerializer::deserialize( + $e->getResponseBody(), + '\Agnesoft\AgdbApi\Model\UserStatus', + $e->getResponseHeaders() + ); + $e->setResponseObject($data); + break; + } + throw $e; + } + } + + /** + * Operation userStatusAsync + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userStatusAsync(string $contentType = self::contentTypes['userStatus'][0]) + { + return $this->userStatusAsyncWithHttpInfo($contentType) + ->then( + function ($response) { + return $response[0]; + } + ); + } + + /** + * Operation userStatusAsyncWithHttpInfo + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Promise\PromiseInterface + */ + public function userStatusAsyncWithHttpInfo(string $contentType = self::contentTypes['userStatus'][0]) + { + $returnType = '\Agnesoft\AgdbApi\Model\UserStatus'; + $request = $this->userStatusRequest($contentType); + + return $this->client + ->sendAsync($request, $this->createHttpClientOption()) + ->then( + function ($response) use ($returnType) { + if ($returnType === '\SplFileObject') { + $content = $response->getBody(); //stream goes to serializer + } else { + $content = (string) $response->getBody(); + if ($returnType !== 'string') { + $content = json_decode($content); + } + } + + return [ + ObjectSerializer::deserialize($content, $returnType, []), + $response->getStatusCode(), + $response->getHeaders() + ]; + }, + function ($exception) { + $response = $exception->getResponse(); + $statusCode = $response->getStatusCode(); + throw new ApiException( + sprintf( + '[%d] Error connecting to the API (%s)', + $statusCode, + $exception->getRequest()->getUri() + ), + $statusCode, + $response->getHeaders(), + (string) $response->getBody() + ); + } + ); + } + + /** + * Create request for operation 'userStatus' + * + * @param string $contentType The value for the Content-Type header. Check self::contentTypes['userStatus'] to see the possible values for this operation + * + * @throws \InvalidArgumentException + * @return \GuzzleHttp\Psr7\Request + */ + public function userStatusRequest(string $contentType = self::contentTypes['userStatus'][0]) + { + + + $resourcePath = '/api/v1/user/status'; + $formParams = []; + $queryParams = []; + $headerParams = []; + $httpBody = ''; + $multipart = false; + + + + + + $headers = $this->headerSelector->selectHeaders( + ['application/json', ], + $contentType, + $multipart + ); + + // for model (json/xml) + if (count($formParams) > 0) { + if ($multipart) { + $multipartContents = []; + foreach ($formParams as $formParamName => $formParamValue) { + $formParamValueItems = is_array($formParamValue) ? $formParamValue : [$formParamValue]; + foreach ($formParamValueItems as $formParamValueItem) { + $multipartContents[] = [ + 'name' => $formParamName, + 'contents' => $formParamValueItem + ]; + } + } + // for HTTP post (form) + $httpBody = new MultipartStream($multipartContents); + + } elseif (stripos($headers['Content-Type'], 'application/json') !== false) { + # if Content-Type contains "application/json", json_encode the form parameters + $httpBody = \GuzzleHttp\Utils::jsonEncode($formParams); + } else { + // for HTTP post (form) + $httpBody = ObjectSerializer::buildQuery($formParams); + } + } + + // this endpoint requires Bearer authentication (access token) + if (!empty($this->config->getAccessToken())) { + $headers['Authorization'] = 'Bearer ' . $this->config->getAccessToken(); + } + + $defaultHeaders = []; + if ($this->config->getUserAgent()) { + $defaultHeaders['User-Agent'] = $this->config->getUserAgent(); + } + + $headers = array_merge( + $defaultHeaders, + $headerParams, + $headers + ); + + $operationHost = $this->config->getHost(); + $query = ObjectSerializer::buildQuery($queryParams); + return new Request( + 'GET', + $operationHost . $resourcePath . ($query ? "?{$query}" : ''), + $headers, + $httpBody + ); + } + + /** + * Create http client option + * + * @throws \RuntimeException on file opening failure + * @return array of http client options + */ + protected function createHttpClientOption() + { + $options = []; + if ($this->config->getDebug()) { + $options[RequestOptions::DEBUG] = fopen($this->config->getDebugFile(), 'a'); + if (!$options[RequestOptions::DEBUG]) { + throw new \RuntimeException('Failed to open the debug file: ' . $this->config->getDebugFile()); + } + } + + return $options; + } +} diff --git a/agdb_api/php/lib/ApiException.php b/agdb_api/php/lib/ApiException.php new file mode 100644 index 00000000..0db08360 --- /dev/null +++ b/agdb_api/php/lib/ApiException.php @@ -0,0 +1,119 @@ +responseHeaders = $responseHeaders; + $this->responseBody = $responseBody; + } + + /** + * Gets the HTTP response header + * + * @return string[][]|null HTTP response header + */ + public function getResponseHeaders() + { + return $this->responseHeaders; + } + + /** + * Gets the HTTP body of the server response either as Json or string + * + * @return \stdClass|string|null HTTP body of the server response either as \stdClass or string + */ + public function getResponseBody() + { + return $this->responseBody; + } + + /** + * Sets the deserialized response object (during deserialization) + * + * @param mixed $obj Deserialized response object + * + * @return void + */ + public function setResponseObject($obj) + { + $this->responseObject = $obj; + } + + /** + * Gets the deserialized response object (during deserialization) + * + * @return mixed the deserialized response object + */ + public function getResponseObject() + { + return $this->responseObject; + } +} diff --git a/agdb_api/php/lib/Configuration.php b/agdb_api/php/lib/Configuration.php new file mode 100644 index 00000000..683a7c91 --- /dev/null +++ b/agdb_api/php/lib/Configuration.php @@ -0,0 +1,532 @@ +tempFolderPath = sys_get_temp_dir(); + } + + /** + * Sets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $key API key or token + * + * @return $this + */ + public function setApiKey($apiKeyIdentifier, $key) + { + $this->apiKeys[$apiKeyIdentifier] = $key; + return $this; + } + + /** + * Gets API key + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string API key or token + */ + public function getApiKey($apiKeyIdentifier) + { + return isset($this->apiKeys[$apiKeyIdentifier]) ? $this->apiKeys[$apiKeyIdentifier] : null; + } + + /** + * Sets the prefix for API key (e.g. Bearer) + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * @param string $prefix API key prefix, e.g. Bearer + * + * @return $this + */ + public function setApiKeyPrefix($apiKeyIdentifier, $prefix) + { + $this->apiKeyPrefixes[$apiKeyIdentifier] = $prefix; + return $this; + } + + /** + * Gets API key prefix + * + * @param string $apiKeyIdentifier API key identifier (authentication scheme) + * + * @return null|string + */ + public function getApiKeyPrefix($apiKeyIdentifier) + { + return isset($this->apiKeyPrefixes[$apiKeyIdentifier]) ? $this->apiKeyPrefixes[$apiKeyIdentifier] : null; + } + + /** + * Sets the access token for OAuth + * + * @param string $accessToken Token for OAuth + * + * @return $this + */ + public function setAccessToken($accessToken) + { + $this->accessToken = $accessToken; + return $this; + } + + /** + * Gets the access token for OAuth + * + * @return string Access token for OAuth + */ + public function getAccessToken() + { + return $this->accessToken; + } + + /** + * Sets boolean format for query string. + * + * @param string $booleanFormat Boolean format for query string + * + * @return $this + */ + public function setBooleanFormatForQueryString(string $booleanFormat) + { + $this->booleanFormatForQueryString = $booleanFormat; + + return $this; + } + + /** + * Gets boolean format for query string. + * + * @return string Boolean format for query string + */ + public function getBooleanFormatForQueryString(): string + { + return $this->booleanFormatForQueryString; + } + + /** + * Sets the username for HTTP basic authentication + * + * @param string $username Username for HTTP basic authentication + * + * @return $this + */ + public function setUsername($username) + { + $this->username = $username; + return $this; + } + + /** + * Gets the username for HTTP basic authentication + * + * @return string Username for HTTP basic authentication + */ + public function getUsername() + { + return $this->username; + } + + /** + * Sets the password for HTTP basic authentication + * + * @param string $password Password for HTTP basic authentication + * + * @return $this + */ + public function setPassword($password) + { + $this->password = $password; + return $this; + } + + /** + * Gets the password for HTTP basic authentication + * + * @return string Password for HTTP basic authentication + */ + public function getPassword() + { + return $this->password; + } + + /** + * Sets the host + * + * @param string $host Host + * + * @return $this + */ + public function setHost($host) + { + $this->host = $host; + return $this; + } + + /** + * Gets the host + * + * @return string Host + */ + public function getHost() + { + return $this->host; + } + + /** + * Sets the user agent of the api client + * + * @param string $userAgent the user agent of the api client + * + * @throws \InvalidArgumentException + * @return $this + */ + public function setUserAgent($userAgent) + { + if (!is_string($userAgent)) { + throw new \InvalidArgumentException('User-agent must be a string.'); + } + + $this->userAgent = $userAgent; + return $this; + } + + /** + * Gets the user agent of the api client + * + * @return string user agent + */ + public function getUserAgent() + { + return $this->userAgent; + } + + /** + * Sets debug flag + * + * @param bool $debug Debug flag + * + * @return $this + */ + public function setDebug($debug) + { + $this->debug = $debug; + return $this; + } + + /** + * Gets the debug flag + * + * @return bool + */ + public function getDebug() + { + return $this->debug; + } + + /** + * Sets the debug file + * + * @param string $debugFile Debug file + * + * @return $this + */ + public function setDebugFile($debugFile) + { + $this->debugFile = $debugFile; + return $this; + } + + /** + * Gets the debug file + * + * @return string + */ + public function getDebugFile() + { + return $this->debugFile; + } + + /** + * Sets the temp folder path + * + * @param string $tempFolderPath Temp folder path + * + * @return $this + */ + public function setTempFolderPath($tempFolderPath) + { + $this->tempFolderPath = $tempFolderPath; + return $this; + } + + /** + * Gets the temp folder path + * + * @return string Temp folder path + */ + public function getTempFolderPath() + { + return $this->tempFolderPath; + } + + /** + * Gets the default configuration instance + * + * @return Configuration + */ + public static function getDefaultConfiguration() + { + if (self::$defaultConfiguration === null) { + self::$defaultConfiguration = new Configuration(); + } + + return self::$defaultConfiguration; + } + + /** + * Sets the default configuration instance + * + * @param Configuration $config An instance of the Configuration Object + * + * @return void + */ + public static function setDefaultConfiguration(Configuration $config) + { + self::$defaultConfiguration = $config; + } + + /** + * Gets the essential information for debugging + * + * @return string The report for debugging + */ + public static function toDebugReport() + { + $report = 'PHP SDK (Agnesoft\AgdbApi) Debug Report:' . PHP_EOL; + $report .= ' OS: ' . php_uname() . PHP_EOL; + $report .= ' PHP Version: ' . PHP_VERSION . PHP_EOL; + $report .= ' The version of the OpenAPI document: 0.9.2' . PHP_EOL; + $report .= ' SDK Package Version: 0.7.2' . PHP_EOL; + $report .= ' Temp Folder Path: ' . self::getDefaultConfiguration()->getTempFolderPath() . PHP_EOL; + + return $report; + } + + /** + * Get API key (with prefix if set) + * + * @param string $apiKeyIdentifier name of apikey + * + * @return null|string API key with the prefix + */ + public function getApiKeyWithPrefix($apiKeyIdentifier) + { + $prefix = $this->getApiKeyPrefix($apiKeyIdentifier); + $apiKey = $this->getApiKey($apiKeyIdentifier); + + if ($apiKey === null) { + return null; + } + + if ($prefix === null) { + $keyWithPrefix = $apiKey; + } else { + $keyWithPrefix = $prefix . ' ' . $apiKey; + } + + return $keyWithPrefix; + } + + /** + * Returns an array of host settings + * + * @return array an array of host settings + */ + public function getHostSettings() + { + return [ + [ + "url" => "http://localhost:3000", + "description" => "Local server", + ] + ]; + } + + /** + * Returns URL based on host settings, index and variables + * + * @param array $hostSettings array of host settings, generated from getHostSettings() or equivalent from the API clients + * @param int $hostIndex index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public static function getHostString(array $hostSettings, $hostIndex, array $variables = null) + { + if (null === $variables) { + $variables = []; + } + + // check array index out of bound + if ($hostIndex < 0 || $hostIndex >= count($hostSettings)) { + throw new \InvalidArgumentException("Invalid index $hostIndex when selecting the host. Must be less than ".count($hostSettings)); + } + + $host = $hostSettings[$hostIndex]; + $url = $host["url"]; + + // go through variable and assign a value + foreach ($host["variables"] ?? [] as $name => $variable) { + if (array_key_exists($name, $variables)) { // check to see if it's in the variables provided by the user + if (!isset($variable['enum_values']) || in_array($variables[$name], $variable["enum_values"], true)) { // check to see if the value is in the enum + $url = str_replace("{".$name."}", $variables[$name], $url); + } else { + throw new \InvalidArgumentException("The variable `$name` in the host URL has invalid value ".$variables[$name].". Must be ".join(',', $variable["enum_values"])."."); + } + } else { + // use default value + $url = str_replace("{".$name."}", $variable["default_value"], $url); + } + } + + return $url; + } + + /** + * Returns URL based on the index and variables + * + * @param int $index index of the host settings + * @param array|null $variables hash of variable and the corresponding value (optional) + * @return string URL based on host settings + */ + public function getHostFromSettings($index, $variables = null) + { + return self::getHostString($this->getHostSettings(), $index, $variables); + } +} diff --git a/agdb_api/php/lib/HeaderSelector.php b/agdb_api/php/lib/HeaderSelector.php new file mode 100644 index 00000000..fdd01928 --- /dev/null +++ b/agdb_api/php/lib/HeaderSelector.php @@ -0,0 +1,273 @@ +selectAcceptHeader($accept); + if ($accept !== null) { + $headers['Accept'] = $accept; + } + + if (!$isMultipart) { + if($contentType === '') { + $contentType = 'application/json'; + } + + $headers['Content-Type'] = $contentType; + } + + return $headers; + } + + /** + * Return the header 'Accept' based on an array of Accept provided. + * + * @param string[] $accept Array of header + * + * @return null|string Accept (e.g. application/json) + */ + private function selectAcceptHeader(array $accept): ?string + { + # filter out empty entries + $accept = array_filter($accept); + + if (count($accept) === 0) { + return null; + } + + # If there's only one Accept header, just use it + if (count($accept) === 1) { + return reset($accept); + } + + # If none of the available Accept headers is of type "json", then just use all them + $headersWithJson = $this->selectJsonMimeList($accept); + if (count($headersWithJson) === 0) { + return implode(',', $accept); + } + + # If we got here, then we need add quality values (weight), as described in IETF RFC 9110, Items 12.4.2/12.5.1, + # to give the highest priority to json-like headers - recalculating the existing ones, if needed + return $this->getAcceptHeaderWithAdjustedWeight($accept, $headersWithJson); + } + + /** + * Detects whether a string contains a valid JSON mime type + * + * @param string $searchString + * @return bool + */ + public function isJsonMime(string $searchString): bool + { + return preg_match('~^application/(json|[\w!#$&.+-^_]+\+json)\s*(;|$)~', $searchString) === 1; + } + + /** + * Select all items from a list containing a JSON mime type + * + * @param array $mimeList + * @return array + */ + private function selectJsonMimeList(array $mimeList): array { + $jsonMimeList = []; + foreach ($mimeList as $mime) { + if($this->isJsonMime($mime)) { + $jsonMimeList[] = $mime; + } + } + return $jsonMimeList; + } + + + /** + * Create an Accept header string from the given "Accept" headers array, recalculating all weights + * + * @param string[] $accept Array of Accept Headers + * @param string[] $headersWithJson Array of Accept Headers of type "json" + * + * @return string "Accept" Header (e.g. "application/json, text/html; q=0.9") + */ + private function getAcceptHeaderWithAdjustedWeight(array $accept, array $headersWithJson): string + { + $processedHeaders = [ + 'withApplicationJson' => [], + 'withJson' => [], + 'withoutJson' => [], + ]; + + foreach ($accept as $header) { + + $headerData = $this->getHeaderAndWeight($header); + + if (stripos($headerData['header'], 'application/json') === 0) { + $processedHeaders['withApplicationJson'][] = $headerData; + } elseif (in_array($header, $headersWithJson, true)) { + $processedHeaders['withJson'][] = $headerData; + } else { + $processedHeaders['withoutJson'][] = $headerData; + } + } + + $acceptHeaders = []; + $currentWeight = 1000; + + $hasMoreThan28Headers = count($accept) > 28; + + foreach($processedHeaders as $headers) { + if (count($headers) > 0) { + $acceptHeaders[] = $this->adjustWeight($headers, $currentWeight, $hasMoreThan28Headers); + } + } + + $acceptHeaders = array_merge(...$acceptHeaders); + + return implode(',', $acceptHeaders); + } + + /** + * Given an Accept header, returns an associative array splitting the header and its weight + * + * @param string $header "Accept" Header + * + * @return array with the header and its weight + */ + private function getHeaderAndWeight(string $header): array + { + # matches headers with weight, splitting the header and the weight in $outputArray + if (preg_match('/(.*);\s*q=(1(?:\.0+)?|0\.\d+)$/', $header, $outputArray) === 1) { + $headerData = [ + 'header' => $outputArray[1], + 'weight' => (int)($outputArray[2] * 1000), + ]; + } else { + $headerData = [ + 'header' => trim($header), + 'weight' => 1000, + ]; + } + + return $headerData; + } + + /** + * @param array[] $headers + * @param float $currentWeight + * @param bool $hasMoreThan28Headers + * @return string[] array of adjusted "Accept" headers + */ + private function adjustWeight(array $headers, float &$currentWeight, bool $hasMoreThan28Headers): array + { + usort($headers, function (array $a, array $b) { + return $b['weight'] - $a['weight']; + }); + + $acceptHeaders = []; + foreach ($headers as $index => $header) { + if($index > 0 && $headers[$index - 1]['weight'] > $header['weight']) + { + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + } + + $weight = $currentWeight; + + $acceptHeaders[] = $this->buildAcceptHeader($header['header'], $weight); + } + + $currentWeight = $this->getNextWeight($currentWeight, $hasMoreThan28Headers); + + return $acceptHeaders; + } + + /** + * @param string $header + * @param int $weight + * @return string + */ + private function buildAcceptHeader(string $header, int $weight): string + { + if($weight === 1000) { + return $header; + } + + return trim($header, '; ') . ';q=' . rtrim(sprintf('%0.3f', $weight / 1000), '0'); + } + + /** + * Calculate the next weight, based on the current one. + * + * If there are less than 28 "Accept" headers, the weights will be decreased by 1 on its highest significant digit, using the + * following formula: + * + * next weight = current weight - 10 ^ (floor(log(current weight - 1))) + * + * ( current weight minus ( 10 raised to the power of ( floor of (log to the base 10 of ( current weight minus 1 ) ) ) ) ) + * + * Starting from 1000, this generates the following series: + * + * 1000, 900, 800, 700, 600, 500, 400, 300, 200, 100, 90, 80, 70, 60, 50, 40, 30, 20, 10, 9, 8, 7, 6, 5, 4, 3, 2, 1 + * + * The resulting quality codes are closer to the average "normal" usage of them (like "q=0.9", "q=0.8" and so on), but it only works + * if there is a maximum of 28 "Accept" headers. If we have more than that (which is extremely unlikely), then we fall back to a 1-by-1 + * decrement rule, which will result in quality codes like "q=0.999", "q=0.998" etc. + * + * @param int $currentWeight varying from 1 to 1000 (will be divided by 1000 to build the quality value) + * @param bool $hasMoreThan28Headers + * @return int + */ + public function getNextWeight(int $currentWeight, bool $hasMoreThan28Headers): int + { + if ($currentWeight <= 1) { + return 1; + } + + if ($hasMoreThan28Headers) { + return $currentWeight - 1; + } + + return $currentWeight - 10 ** floor( log10($currentWeight - 1) ); + } +} diff --git a/agdb_api/php/lib/Model/AdminStatus.php b/agdb_api/php/lib/Model/AdminStatus.php new file mode 100644 index 00000000..a7ca6687 --- /dev/null +++ b/agdb_api/php/lib/Model/AdminStatus.php @@ -0,0 +1,605 @@ + + */ +class AdminStatus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'AdminStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'dbs' => 'int', + 'logged_in_users' => 'int', + 'size' => 'int', + 'uptime' => 'int', + 'users' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'dbs' => 'int64', + 'logged_in_users' => 'int64', + 'size' => 'int64', + 'uptime' => 'int64', + 'users' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'dbs' => false, + 'logged_in_users' => false, + 'size' => false, + 'uptime' => false, + 'users' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'dbs' => 'dbs', + 'logged_in_users' => 'logged_in_users', + 'size' => 'size', + 'uptime' => 'uptime', + 'users' => 'users' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'dbs' => 'setDbs', + 'logged_in_users' => 'setLoggedInUsers', + 'size' => 'setSize', + 'uptime' => 'setUptime', + 'users' => 'setUsers' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'dbs' => 'getDbs', + 'logged_in_users' => 'getLoggedInUsers', + 'size' => 'getSize', + 'uptime' => 'getUptime', + 'users' => 'getUsers' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('dbs', $data ?? [], null); + $this->setIfExists('logged_in_users', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + $this->setIfExists('uptime', $data ?? [], null); + $this->setIfExists('users', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['dbs'] === null) { + $invalidProperties[] = "'dbs' can't be null"; + } + if (($this->container['dbs'] < 0)) { + $invalidProperties[] = "invalid value for 'dbs', must be bigger than or equal to 0."; + } + + if ($this->container['logged_in_users'] === null) { + $invalidProperties[] = "'logged_in_users' can't be null"; + } + if (($this->container['logged_in_users'] < 0)) { + $invalidProperties[] = "invalid value for 'logged_in_users', must be bigger than or equal to 0."; + } + + if ($this->container['size'] === null) { + $invalidProperties[] = "'size' can't be null"; + } + if (($this->container['size'] < 0)) { + $invalidProperties[] = "invalid value for 'size', must be bigger than or equal to 0."; + } + + if ($this->container['uptime'] === null) { + $invalidProperties[] = "'uptime' can't be null"; + } + if (($this->container['uptime'] < 0)) { + $invalidProperties[] = "invalid value for 'uptime', must be bigger than or equal to 0."; + } + + if ($this->container['users'] === null) { + $invalidProperties[] = "'users' can't be null"; + } + if (($this->container['users'] < 0)) { + $invalidProperties[] = "invalid value for 'users', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets dbs + * + * @return int + */ + public function getDbs() + { + return $this->container['dbs']; + } + + /** + * Sets dbs + * + * @param int $dbs dbs + * + * @return self + */ + public function setDbs($dbs) + { + if (is_null($dbs)) { + throw new \InvalidArgumentException('non-nullable dbs cannot be null'); + } + + if (($dbs < 0)) { + throw new \InvalidArgumentException('invalid value for $dbs when calling AdminStatus., must be bigger than or equal to 0.'); + } + + $this->container['dbs'] = $dbs; + + return $this; + } + + /** + * Gets logged_in_users + * + * @return int + */ + public function getLoggedInUsers() + { + return $this->container['logged_in_users']; + } + + /** + * Sets logged_in_users + * + * @param int $logged_in_users logged_in_users + * + * @return self + */ + public function setLoggedInUsers($logged_in_users) + { + if (is_null($logged_in_users)) { + throw new \InvalidArgumentException('non-nullable logged_in_users cannot be null'); + } + + if (($logged_in_users < 0)) { + throw new \InvalidArgumentException('invalid value for $logged_in_users when calling AdminStatus., must be bigger than or equal to 0.'); + } + + $this->container['logged_in_users'] = $logged_in_users; + + return $this; + } + + /** + * Gets size + * + * @return int + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int $size size + * + * @return self + */ + public function setSize($size) + { + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + if (($size < 0)) { + throw new \InvalidArgumentException('invalid value for $size when calling AdminStatus., must be bigger than or equal to 0.'); + } + + $this->container['size'] = $size; + + return $this; + } + + /** + * Gets uptime + * + * @return int + */ + public function getUptime() + { + return $this->container['uptime']; + } + + /** + * Sets uptime + * + * @param int $uptime uptime + * + * @return self + */ + public function setUptime($uptime) + { + if (is_null($uptime)) { + throw new \InvalidArgumentException('non-nullable uptime cannot be null'); + } + + if (($uptime < 0)) { + throw new \InvalidArgumentException('invalid value for $uptime when calling AdminStatus., must be bigger than or equal to 0.'); + } + + $this->container['uptime'] = $uptime; + + return $this; + } + + /** + * Gets users + * + * @return int + */ + public function getUsers() + { + return $this->container['users']; + } + + /** + * Sets users + * + * @param int $users users + * + * @return self + */ + public function setUsers($users) + { + if (is_null($users)) { + throw new \InvalidArgumentException('non-nullable users cannot be null'); + } + + if (($users < 0)) { + throw new \InvalidArgumentException('invalid value for $users when calling AdminStatus., must be bigger than or equal to 0.'); + } + + $this->container['users'] = $users; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ChangePassword.php b/agdb_api/php/lib/Model/ChangePassword.php new file mode 100644 index 00000000..1b651108 --- /dev/null +++ b/agdb_api/php/lib/Model/ChangePassword.php @@ -0,0 +1,449 @@ + + */ +class ChangePassword implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ChangePassword'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'new_password' => 'string', + 'password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'new_password' => null, + 'password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'new_password' => false, + 'password' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'new_password' => 'new_password', + 'password' => 'password' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'new_password' => 'setNewPassword', + 'password' => 'setPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'new_password' => 'getNewPassword', + 'password' => 'getPassword' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('new_password', $data ?? [], null); + $this->setIfExists('password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['new_password'] === null) { + $invalidProperties[] = "'new_password' can't be null"; + } + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets new_password + * + * @return string + */ + public function getNewPassword() + { + return $this->container['new_password']; + } + + /** + * Sets new_password + * + * @param string $new_password new_password + * + * @return self + */ + public function setNewPassword($new_password) + { + if (is_null($new_password)) { + throw new \InvalidArgumentException('non-nullable new_password cannot be null'); + } + $this->container['new_password'] = $new_password; + + return $this; + } + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ClusterStatus.php b/agdb_api/php/lib/Model/ClusterStatus.php new file mode 100644 index 00000000..cd500102 --- /dev/null +++ b/agdb_api/php/lib/Model/ClusterStatus.php @@ -0,0 +1,578 @@ + + */ +class ClusterStatus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ClusterStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'address' => 'string', + 'commit' => 'int', + 'leader' => 'bool', + 'status' => 'bool', + 'term' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'address' => null, + 'commit' => 'int64', + 'leader' => null, + 'status' => null, + 'term' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'address' => false, + 'commit' => false, + 'leader' => false, + 'status' => false, + 'term' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'address' => 'address', + 'commit' => 'commit', + 'leader' => 'leader', + 'status' => 'status', + 'term' => 'term' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'address' => 'setAddress', + 'commit' => 'setCommit', + 'leader' => 'setLeader', + 'status' => 'setStatus', + 'term' => 'setTerm' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'address' => 'getAddress', + 'commit' => 'getCommit', + 'leader' => 'getLeader', + 'status' => 'getStatus', + 'term' => 'getTerm' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('address', $data ?? [], null); + $this->setIfExists('commit', $data ?? [], null); + $this->setIfExists('leader', $data ?? [], null); + $this->setIfExists('status', $data ?? [], null); + $this->setIfExists('term', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['address'] === null) { + $invalidProperties[] = "'address' can't be null"; + } + if ($this->container['commit'] === null) { + $invalidProperties[] = "'commit' can't be null"; + } + if (($this->container['commit'] < 0)) { + $invalidProperties[] = "invalid value for 'commit', must be bigger than or equal to 0."; + } + + if ($this->container['leader'] === null) { + $invalidProperties[] = "'leader' can't be null"; + } + if ($this->container['status'] === null) { + $invalidProperties[] = "'status' can't be null"; + } + if ($this->container['term'] === null) { + $invalidProperties[] = "'term' can't be null"; + } + if (($this->container['term'] < 0)) { + $invalidProperties[] = "invalid value for 'term', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets address + * + * @return string + */ + public function getAddress() + { + return $this->container['address']; + } + + /** + * Sets address + * + * @param string $address address + * + * @return self + */ + public function setAddress($address) + { + if (is_null($address)) { + throw new \InvalidArgumentException('non-nullable address cannot be null'); + } + $this->container['address'] = $address; + + return $this; + } + + /** + * Gets commit + * + * @return int + */ + public function getCommit() + { + return $this->container['commit']; + } + + /** + * Sets commit + * + * @param int $commit commit + * + * @return self + */ + public function setCommit($commit) + { + if (is_null($commit)) { + throw new \InvalidArgumentException('non-nullable commit cannot be null'); + } + + if (($commit < 0)) { + throw new \InvalidArgumentException('invalid value for $commit when calling ClusterStatus., must be bigger than or equal to 0.'); + } + + $this->container['commit'] = $commit; + + return $this; + } + + /** + * Gets leader + * + * @return bool + */ + public function getLeader() + { + return $this->container['leader']; + } + + /** + * Sets leader + * + * @param bool $leader leader + * + * @return self + */ + public function setLeader($leader) + { + if (is_null($leader)) { + throw new \InvalidArgumentException('non-nullable leader cannot be null'); + } + $this->container['leader'] = $leader; + + return $this; + } + + /** + * Gets status + * + * @return bool + */ + public function getStatus() + { + return $this->container['status']; + } + + /** + * Sets status + * + * @param bool $status status + * + * @return self + */ + public function setStatus($status) + { + if (is_null($status)) { + throw new \InvalidArgumentException('non-nullable status cannot be null'); + } + $this->container['status'] = $status; + + return $this; + } + + /** + * Gets term + * + * @return int + */ + public function getTerm() + { + return $this->container['term']; + } + + /** + * Sets term + * + * @param int $term term + * + * @return self + */ + public function setTerm($term) + { + if (is_null($term)) { + throw new \InvalidArgumentException('non-nullable term cannot be null'); + } + + if (($term < 0)) { + throw new \InvalidArgumentException('invalid value for $term when calling ClusterStatus., must be bigger than or equal to 0.'); + } + + $this->container['term'] = $term; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/Comparison.php b/agdb_api/php/lib/Model/Comparison.php new file mode 100644 index 00000000..5fc46060 --- /dev/null +++ b/agdb_api/php/lib/Model/Comparison.php @@ -0,0 +1,635 @@ + + */ +class Comparison implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'equal' => '\Agnesoft\AgdbApi\Model\DbValue', + 'greater_than' => '\Agnesoft\AgdbApi\Model\DbValue', + 'greater_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue', + 'less_than' => '\Agnesoft\AgdbApi\Model\DbValue', + 'less_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue', + 'not_equal' => '\Agnesoft\AgdbApi\Model\DbValue', + 'contains' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'equal' => null, + 'greater_than' => null, + 'greater_than_or_equal' => null, + 'less_than' => null, + 'less_than_or_equal' => null, + 'not_equal' => null, + 'contains' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'equal' => false, + 'greater_than' => false, + 'greater_than_or_equal' => false, + 'less_than' => false, + 'less_than_or_equal' => false, + 'not_equal' => false, + 'contains' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'equal' => 'Equal', + 'greater_than' => 'GreaterThan', + 'greater_than_or_equal' => 'GreaterThanOrEqual', + 'less_than' => 'LessThan', + 'less_than_or_equal' => 'LessThanOrEqual', + 'not_equal' => 'NotEqual', + 'contains' => 'Contains' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'equal' => 'setEqual', + 'greater_than' => 'setGreaterThan', + 'greater_than_or_equal' => 'setGreaterThanOrEqual', + 'less_than' => 'setLessThan', + 'less_than_or_equal' => 'setLessThanOrEqual', + 'not_equal' => 'setNotEqual', + 'contains' => 'setContains' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'equal' => 'getEqual', + 'greater_than' => 'getGreaterThan', + 'greater_than_or_equal' => 'getGreaterThanOrEqual', + 'less_than' => 'getLessThan', + 'less_than_or_equal' => 'getLessThanOrEqual', + 'not_equal' => 'getNotEqual', + 'contains' => 'getContains' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('equal', $data ?? [], null); + $this->setIfExists('greater_than', $data ?? [], null); + $this->setIfExists('greater_than_or_equal', $data ?? [], null); + $this->setIfExists('less_than', $data ?? [], null); + $this->setIfExists('less_than_or_equal', $data ?? [], null); + $this->setIfExists('not_equal', $data ?? [], null); + $this->setIfExists('contains', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['equal'] === null) { + $invalidProperties[] = "'equal' can't be null"; + } + if ($this->container['greater_than'] === null) { + $invalidProperties[] = "'greater_than' can't be null"; + } + if ($this->container['greater_than_or_equal'] === null) { + $invalidProperties[] = "'greater_than_or_equal' can't be null"; + } + if ($this->container['less_than'] === null) { + $invalidProperties[] = "'less_than' can't be null"; + } + if ($this->container['less_than_or_equal'] === null) { + $invalidProperties[] = "'less_than_or_equal' can't be null"; + } + if ($this->container['not_equal'] === null) { + $invalidProperties[] = "'not_equal' can't be null"; + } + if ($this->container['contains'] === null) { + $invalidProperties[] = "'contains' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getEqual() + { + return $this->container['equal']; + } + + /** + * Sets equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $equal equal + * + * @return self + */ + public function setEqual($equal) + { + if (is_null($equal)) { + throw new \InvalidArgumentException('non-nullable equal cannot be null'); + } + $this->container['equal'] = $equal; + + return $this; + } + + /** + * Gets greater_than + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getGreaterThan() + { + return $this->container['greater_than']; + } + + /** + * Sets greater_than + * + * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than greater_than + * + * @return self + */ + public function setGreaterThan($greater_than) + { + if (is_null($greater_than)) { + throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); + } + $this->container['greater_than'] = $greater_than; + + return $this; + } + + /** + * Gets greater_than_or_equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getGreaterThanOrEqual() + { + return $this->container['greater_than_or_equal']; + } + + /** + * Sets greater_than_or_equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than_or_equal greater_than_or_equal + * + * @return self + */ + public function setGreaterThanOrEqual($greater_than_or_equal) + { + if (is_null($greater_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); + } + $this->container['greater_than_or_equal'] = $greater_than_or_equal; + + return $this; + } + + /** + * Gets less_than + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getLessThan() + { + return $this->container['less_than']; + } + + /** + * Sets less_than + * + * @param \Agnesoft\AgdbApi\Model\DbValue $less_than less_than + * + * @return self + */ + public function setLessThan($less_than) + { + if (is_null($less_than)) { + throw new \InvalidArgumentException('non-nullable less_than cannot be null'); + } + $this->container['less_than'] = $less_than; + + return $this; + } + + /** + * Gets less_than_or_equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getLessThanOrEqual() + { + return $this->container['less_than_or_equal']; + } + + /** + * Sets less_than_or_equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $less_than_or_equal less_than_or_equal + * + * @return self + */ + public function setLessThanOrEqual($less_than_or_equal) + { + if (is_null($less_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); + } + $this->container['less_than_or_equal'] = $less_than_or_equal; + + return $this; + } + + /** + * Gets not_equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getNotEqual() + { + return $this->container['not_equal']; + } + + /** + * Sets not_equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $not_equal not_equal + * + * @return self + */ + public function setNotEqual($not_equal) + { + if (is_null($not_equal)) { + throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); + } + $this->container['not_equal'] = $not_equal; + + return $this; + } + + /** + * Gets contains + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getContains() + { + return $this->container['contains']; + } + + /** + * Sets contains + * + * @param \Agnesoft\AgdbApi\Model\DbValue $contains contains + * + * @return self + */ + public function setContains($contains) + { + if (is_null($contains)) { + throw new \InvalidArgumentException('non-nullable contains cannot be null'); + } + $this->container['contains'] = $contains; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ComparisonOneOf.php b/agdb_api/php/lib/Model/ComparisonOneOf.php new file mode 100644 index 00000000..cb62784b --- /dev/null +++ b/agdb_api/php/lib/Model/ComparisonOneOf.php @@ -0,0 +1,412 @@ + + */ +class ComparisonOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'equal' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'equal' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'equal' => 'Equal' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'equal' => 'setEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'equal' => 'getEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['equal'] === null) { + $invalidProperties[] = "'equal' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getEqual() + { + return $this->container['equal']; + } + + /** + * Sets equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $equal equal + * + * @return self + */ + public function setEqual($equal) + { + if (is_null($equal)) { + throw new \InvalidArgumentException('non-nullable equal cannot be null'); + } + $this->container['equal'] = $equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ComparisonOneOf1.php b/agdb_api/php/lib/Model/ComparisonOneOf1.php new file mode 100644 index 00000000..7ca00987 --- /dev/null +++ b/agdb_api/php/lib/Model/ComparisonOneOf1.php @@ -0,0 +1,412 @@ + + */ +class ComparisonOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'greater_than' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'greater_than' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'greater_than' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'greater_than' => 'GreaterThan' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'greater_than' => 'setGreaterThan' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'greater_than' => 'getGreaterThan' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('greater_than', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['greater_than'] === null) { + $invalidProperties[] = "'greater_than' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets greater_than + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getGreaterThan() + { + return $this->container['greater_than']; + } + + /** + * Sets greater_than + * + * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than greater_than + * + * @return self + */ + public function setGreaterThan($greater_than) + { + if (is_null($greater_than)) { + throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); + } + $this->container['greater_than'] = $greater_than; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ComparisonOneOf2.php b/agdb_api/php/lib/Model/ComparisonOneOf2.php new file mode 100644 index 00000000..a5e7f2e1 --- /dev/null +++ b/agdb_api/php/lib/Model/ComparisonOneOf2.php @@ -0,0 +1,412 @@ + + */ +class ComparisonOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison_oneOf_2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'greater_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'greater_than_or_equal' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'greater_than_or_equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'greater_than_or_equal' => 'GreaterThanOrEqual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'greater_than_or_equal' => 'setGreaterThanOrEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'greater_than_or_equal' => 'getGreaterThanOrEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('greater_than_or_equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['greater_than_or_equal'] === null) { + $invalidProperties[] = "'greater_than_or_equal' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets greater_than_or_equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getGreaterThanOrEqual() + { + return $this->container['greater_than_or_equal']; + } + + /** + * Sets greater_than_or_equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $greater_than_or_equal greater_than_or_equal + * + * @return self + */ + public function setGreaterThanOrEqual($greater_than_or_equal) + { + if (is_null($greater_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); + } + $this->container['greater_than_or_equal'] = $greater_than_or_equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ComparisonOneOf3.php b/agdb_api/php/lib/Model/ComparisonOneOf3.php new file mode 100644 index 00000000..e36fc937 --- /dev/null +++ b/agdb_api/php/lib/Model/ComparisonOneOf3.php @@ -0,0 +1,412 @@ + + */ +class ComparisonOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison_oneOf_3'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'less_than' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'less_than' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'less_than' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'less_than' => 'LessThan' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'less_than' => 'setLessThan' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'less_than' => 'getLessThan' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('less_than', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['less_than'] === null) { + $invalidProperties[] = "'less_than' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets less_than + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getLessThan() + { + return $this->container['less_than']; + } + + /** + * Sets less_than + * + * @param \Agnesoft\AgdbApi\Model\DbValue $less_than less_than + * + * @return self + */ + public function setLessThan($less_than) + { + if (is_null($less_than)) { + throw new \InvalidArgumentException('non-nullable less_than cannot be null'); + } + $this->container['less_than'] = $less_than; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ComparisonOneOf4.php b/agdb_api/php/lib/Model/ComparisonOneOf4.php new file mode 100644 index 00000000..251934b2 --- /dev/null +++ b/agdb_api/php/lib/Model/ComparisonOneOf4.php @@ -0,0 +1,412 @@ + + */ +class ComparisonOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison_oneOf_4'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'less_than_or_equal' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'less_than_or_equal' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'less_than_or_equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'less_than_or_equal' => 'LessThanOrEqual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'less_than_or_equal' => 'setLessThanOrEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'less_than_or_equal' => 'getLessThanOrEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('less_than_or_equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['less_than_or_equal'] === null) { + $invalidProperties[] = "'less_than_or_equal' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets less_than_or_equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getLessThanOrEqual() + { + return $this->container['less_than_or_equal']; + } + + /** + * Sets less_than_or_equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $less_than_or_equal less_than_or_equal + * + * @return self + */ + public function setLessThanOrEqual($less_than_or_equal) + { + if (is_null($less_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); + } + $this->container['less_than_or_equal'] = $less_than_or_equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ComparisonOneOf5.php b/agdb_api/php/lib/Model/ComparisonOneOf5.php new file mode 100644 index 00000000..730e6f1a --- /dev/null +++ b/agdb_api/php/lib/Model/ComparisonOneOf5.php @@ -0,0 +1,412 @@ + + */ +class ComparisonOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison_oneOf_5'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'not_equal' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'not_equal' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'not_equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'not_equal' => 'NotEqual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'not_equal' => 'setNotEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'not_equal' => 'getNotEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('not_equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['not_equal'] === null) { + $invalidProperties[] = "'not_equal' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets not_equal + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getNotEqual() + { + return $this->container['not_equal']; + } + + /** + * Sets not_equal + * + * @param \Agnesoft\AgdbApi\Model\DbValue $not_equal not_equal + * + * @return self + */ + public function setNotEqual($not_equal) + { + if (is_null($not_equal)) { + throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); + } + $this->container['not_equal'] = $not_equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ComparisonOneOf6.php b/agdb_api/php/lib/Model/ComparisonOneOf6.php new file mode 100644 index 00000000..ff775747 --- /dev/null +++ b/agdb_api/php/lib/Model/ComparisonOneOf6.php @@ -0,0 +1,412 @@ + + */ +class ComparisonOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'Comparison_oneOf_6'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'contains' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'contains' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'contains' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'contains' => 'Contains' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'contains' => 'setContains' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'contains' => 'getContains' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('contains', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['contains'] === null) { + $invalidProperties[] = "'contains' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets contains + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getContains() + { + return $this->container['contains']; + } + + /** + * Sets contains + * + * @param \Agnesoft\AgdbApi\Model\DbValue $contains contains + * + * @return self + */ + public function setContains($contains) + { + if (is_null($contains)) { + throw new \InvalidArgumentException('non-nullable contains cannot be null'); + } + $this->container['contains'] = $contains; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/CountComparison.php b/agdb_api/php/lib/Model/CountComparison.php new file mode 100644 index 00000000..f91ef4ad --- /dev/null +++ b/agdb_api/php/lib/Model/CountComparison.php @@ -0,0 +1,652 @@ + + */ +class CountComparison implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountComparison'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'equal' => 'int', + 'greater_than' => 'int', + 'greater_than_or_equal' => 'int', + 'less_than' => 'int', + 'less_than_or_equal' => 'int', + 'not_equal' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'equal' => 'int64', + 'greater_than' => 'int64', + 'greater_than_or_equal' => 'int64', + 'less_than' => 'int64', + 'less_than_or_equal' => 'int64', + 'not_equal' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'equal' => false, + 'greater_than' => false, + 'greater_than_or_equal' => false, + 'less_than' => false, + 'less_than_or_equal' => false, + 'not_equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'equal' => 'Equal', + 'greater_than' => 'GreaterThan', + 'greater_than_or_equal' => 'GreaterThanOrEqual', + 'less_than' => 'LessThan', + 'less_than_or_equal' => 'LessThanOrEqual', + 'not_equal' => 'NotEqual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'equal' => 'setEqual', + 'greater_than' => 'setGreaterThan', + 'greater_than_or_equal' => 'setGreaterThanOrEqual', + 'less_than' => 'setLessThan', + 'less_than_or_equal' => 'setLessThanOrEqual', + 'not_equal' => 'setNotEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'equal' => 'getEqual', + 'greater_than' => 'getGreaterThan', + 'greater_than_or_equal' => 'getGreaterThanOrEqual', + 'less_than' => 'getLessThan', + 'less_than_or_equal' => 'getLessThanOrEqual', + 'not_equal' => 'getNotEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('equal', $data ?? [], null); + $this->setIfExists('greater_than', $data ?? [], null); + $this->setIfExists('greater_than_or_equal', $data ?? [], null); + $this->setIfExists('less_than', $data ?? [], null); + $this->setIfExists('less_than_or_equal', $data ?? [], null); + $this->setIfExists('not_equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['equal'] === null) { + $invalidProperties[] = "'equal' can't be null"; + } + if (($this->container['equal'] < 0)) { + $invalidProperties[] = "invalid value for 'equal', must be bigger than or equal to 0."; + } + + if ($this->container['greater_than'] === null) { + $invalidProperties[] = "'greater_than' can't be null"; + } + if (($this->container['greater_than'] < 0)) { + $invalidProperties[] = "invalid value for 'greater_than', must be bigger than or equal to 0."; + } + + if ($this->container['greater_than_or_equal'] === null) { + $invalidProperties[] = "'greater_than_or_equal' can't be null"; + } + if (($this->container['greater_than_or_equal'] < 0)) { + $invalidProperties[] = "invalid value for 'greater_than_or_equal', must be bigger than or equal to 0."; + } + + if ($this->container['less_than'] === null) { + $invalidProperties[] = "'less_than' can't be null"; + } + if (($this->container['less_than'] < 0)) { + $invalidProperties[] = "invalid value for 'less_than', must be bigger than or equal to 0."; + } + + if ($this->container['less_than_or_equal'] === null) { + $invalidProperties[] = "'less_than_or_equal' can't be null"; + } + if (($this->container['less_than_or_equal'] < 0)) { + $invalidProperties[] = "invalid value for 'less_than_or_equal', must be bigger than or equal to 0."; + } + + if ($this->container['not_equal'] === null) { + $invalidProperties[] = "'not_equal' can't be null"; + } + if (($this->container['not_equal'] < 0)) { + $invalidProperties[] = "invalid value for 'not_equal', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets equal + * + * @return int + */ + public function getEqual() + { + return $this->container['equal']; + } + + /** + * Sets equal + * + * @param int $equal property == this + * + * @return self + */ + public function setEqual($equal) + { + if (is_null($equal)) { + throw new \InvalidArgumentException('non-nullable equal cannot be null'); + } + + if (($equal < 0)) { + throw new \InvalidArgumentException('invalid value for $equal when calling CountComparison., must be bigger than or equal to 0.'); + } + + $this->container['equal'] = $equal; + + return $this; + } + + /** + * Gets greater_than + * + * @return int + */ + public function getGreaterThan() + { + return $this->container['greater_than']; + } + + /** + * Sets greater_than + * + * @param int $greater_than property > this + * + * @return self + */ + public function setGreaterThan($greater_than) + { + if (is_null($greater_than)) { + throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); + } + + if (($greater_than < 0)) { + throw new \InvalidArgumentException('invalid value for $greater_than when calling CountComparison., must be bigger than or equal to 0.'); + } + + $this->container['greater_than'] = $greater_than; + + return $this; + } + + /** + * Gets greater_than_or_equal + * + * @return int + */ + public function getGreaterThanOrEqual() + { + return $this->container['greater_than_or_equal']; + } + + /** + * Sets greater_than_or_equal + * + * @param int $greater_than_or_equal property >= this + * + * @return self + */ + public function setGreaterThanOrEqual($greater_than_or_equal) + { + if (is_null($greater_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); + } + + if (($greater_than_or_equal < 0)) { + throw new \InvalidArgumentException('invalid value for $greater_than_or_equal when calling CountComparison., must be bigger than or equal to 0.'); + } + + $this->container['greater_than_or_equal'] = $greater_than_or_equal; + + return $this; + } + + /** + * Gets less_than + * + * @return int + */ + public function getLessThan() + { + return $this->container['less_than']; + } + + /** + * Sets less_than + * + * @param int $less_than property < this + * + * @return self + */ + public function setLessThan($less_than) + { + if (is_null($less_than)) { + throw new \InvalidArgumentException('non-nullable less_than cannot be null'); + } + + if (($less_than < 0)) { + throw new \InvalidArgumentException('invalid value for $less_than when calling CountComparison., must be bigger than or equal to 0.'); + } + + $this->container['less_than'] = $less_than; + + return $this; + } + + /** + * Gets less_than_or_equal + * + * @return int + */ + public function getLessThanOrEqual() + { + return $this->container['less_than_or_equal']; + } + + /** + * Sets less_than_or_equal + * + * @param int $less_than_or_equal property <= this + * + * @return self + */ + public function setLessThanOrEqual($less_than_or_equal) + { + if (is_null($less_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); + } + + if (($less_than_or_equal < 0)) { + throw new \InvalidArgumentException('invalid value for $less_than_or_equal when calling CountComparison., must be bigger than or equal to 0.'); + } + + $this->container['less_than_or_equal'] = $less_than_or_equal; + + return $this; + } + + /** + * Gets not_equal + * + * @return int + */ + public function getNotEqual() + { + return $this->container['not_equal']; + } + + /** + * Sets not_equal + * + * @param int $not_equal property != this + * + * @return self + */ + public function setNotEqual($not_equal) + { + if (is_null($not_equal)) { + throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); + } + + if (($not_equal < 0)) { + throw new \InvalidArgumentException('invalid value for $not_equal when calling CountComparison., must be bigger than or equal to 0.'); + } + + $this->container['not_equal'] = $not_equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf.php b/agdb_api/php/lib/Model/CountComparisonOneOf.php new file mode 100644 index 00000000..86233fe8 --- /dev/null +++ b/agdb_api/php/lib/Model/CountComparisonOneOf.php @@ -0,0 +1,421 @@ + + */ +class CountComparisonOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountComparison_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'equal' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'equal' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'equal' => 'Equal' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'equal' => 'setEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'equal' => 'getEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['equal'] === null) { + $invalidProperties[] = "'equal' can't be null"; + } + if (($this->container['equal'] < 0)) { + $invalidProperties[] = "invalid value for 'equal', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets equal + * + * @return int + */ + public function getEqual() + { + return $this->container['equal']; + } + + /** + * Sets equal + * + * @param int $equal property == this + * + * @return self + */ + public function setEqual($equal) + { + if (is_null($equal)) { + throw new \InvalidArgumentException('non-nullable equal cannot be null'); + } + + if (($equal < 0)) { + throw new \InvalidArgumentException('invalid value for $equal when calling CountComparisonOneOf., must be bigger than or equal to 0.'); + } + + $this->container['equal'] = $equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf1.php b/agdb_api/php/lib/Model/CountComparisonOneOf1.php new file mode 100644 index 00000000..ddb69461 --- /dev/null +++ b/agdb_api/php/lib/Model/CountComparisonOneOf1.php @@ -0,0 +1,421 @@ + + */ +class CountComparisonOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountComparison_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'greater_than' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'greater_than' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'greater_than' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'greater_than' => 'GreaterThan' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'greater_than' => 'setGreaterThan' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'greater_than' => 'getGreaterThan' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('greater_than', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['greater_than'] === null) { + $invalidProperties[] = "'greater_than' can't be null"; + } + if (($this->container['greater_than'] < 0)) { + $invalidProperties[] = "invalid value for 'greater_than', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets greater_than + * + * @return int + */ + public function getGreaterThan() + { + return $this->container['greater_than']; + } + + /** + * Sets greater_than + * + * @param int $greater_than property > this + * + * @return self + */ + public function setGreaterThan($greater_than) + { + if (is_null($greater_than)) { + throw new \InvalidArgumentException('non-nullable greater_than cannot be null'); + } + + if (($greater_than < 0)) { + throw new \InvalidArgumentException('invalid value for $greater_than when calling CountComparisonOneOf1., must be bigger than or equal to 0.'); + } + + $this->container['greater_than'] = $greater_than; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf2.php b/agdb_api/php/lib/Model/CountComparisonOneOf2.php new file mode 100644 index 00000000..f7234d2d --- /dev/null +++ b/agdb_api/php/lib/Model/CountComparisonOneOf2.php @@ -0,0 +1,421 @@ + + */ +class CountComparisonOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountComparison_oneOf_2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'greater_than_or_equal' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'greater_than_or_equal' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'greater_than_or_equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'greater_than_or_equal' => 'GreaterThanOrEqual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'greater_than_or_equal' => 'setGreaterThanOrEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'greater_than_or_equal' => 'getGreaterThanOrEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('greater_than_or_equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['greater_than_or_equal'] === null) { + $invalidProperties[] = "'greater_than_or_equal' can't be null"; + } + if (($this->container['greater_than_or_equal'] < 0)) { + $invalidProperties[] = "invalid value for 'greater_than_or_equal', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets greater_than_or_equal + * + * @return int + */ + public function getGreaterThanOrEqual() + { + return $this->container['greater_than_or_equal']; + } + + /** + * Sets greater_than_or_equal + * + * @param int $greater_than_or_equal property >= this + * + * @return self + */ + public function setGreaterThanOrEqual($greater_than_or_equal) + { + if (is_null($greater_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable greater_than_or_equal cannot be null'); + } + + if (($greater_than_or_equal < 0)) { + throw new \InvalidArgumentException('invalid value for $greater_than_or_equal when calling CountComparisonOneOf2., must be bigger than or equal to 0.'); + } + + $this->container['greater_than_or_equal'] = $greater_than_or_equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf3.php b/agdb_api/php/lib/Model/CountComparisonOneOf3.php new file mode 100644 index 00000000..df8350f8 --- /dev/null +++ b/agdb_api/php/lib/Model/CountComparisonOneOf3.php @@ -0,0 +1,421 @@ + + */ +class CountComparisonOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountComparison_oneOf_3'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'less_than' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'less_than' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'less_than' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'less_than' => 'LessThan' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'less_than' => 'setLessThan' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'less_than' => 'getLessThan' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('less_than', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['less_than'] === null) { + $invalidProperties[] = "'less_than' can't be null"; + } + if (($this->container['less_than'] < 0)) { + $invalidProperties[] = "invalid value for 'less_than', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets less_than + * + * @return int + */ + public function getLessThan() + { + return $this->container['less_than']; + } + + /** + * Sets less_than + * + * @param int $less_than property < this + * + * @return self + */ + public function setLessThan($less_than) + { + if (is_null($less_than)) { + throw new \InvalidArgumentException('non-nullable less_than cannot be null'); + } + + if (($less_than < 0)) { + throw new \InvalidArgumentException('invalid value for $less_than when calling CountComparisonOneOf3., must be bigger than or equal to 0.'); + } + + $this->container['less_than'] = $less_than; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf4.php b/agdb_api/php/lib/Model/CountComparisonOneOf4.php new file mode 100644 index 00000000..3a171f1a --- /dev/null +++ b/agdb_api/php/lib/Model/CountComparisonOneOf4.php @@ -0,0 +1,421 @@ + + */ +class CountComparisonOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountComparison_oneOf_4'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'less_than_or_equal' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'less_than_or_equal' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'less_than_or_equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'less_than_or_equal' => 'LessThanOrEqual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'less_than_or_equal' => 'setLessThanOrEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'less_than_or_equal' => 'getLessThanOrEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('less_than_or_equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['less_than_or_equal'] === null) { + $invalidProperties[] = "'less_than_or_equal' can't be null"; + } + if (($this->container['less_than_or_equal'] < 0)) { + $invalidProperties[] = "invalid value for 'less_than_or_equal', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets less_than_or_equal + * + * @return int + */ + public function getLessThanOrEqual() + { + return $this->container['less_than_or_equal']; + } + + /** + * Sets less_than_or_equal + * + * @param int $less_than_or_equal property <= this + * + * @return self + */ + public function setLessThanOrEqual($less_than_or_equal) + { + if (is_null($less_than_or_equal)) { + throw new \InvalidArgumentException('non-nullable less_than_or_equal cannot be null'); + } + + if (($less_than_or_equal < 0)) { + throw new \InvalidArgumentException('invalid value for $less_than_or_equal when calling CountComparisonOneOf4., must be bigger than or equal to 0.'); + } + + $this->container['less_than_or_equal'] = $less_than_or_equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/CountComparisonOneOf5.php b/agdb_api/php/lib/Model/CountComparisonOneOf5.php new file mode 100644 index 00000000..4d8a1012 --- /dev/null +++ b/agdb_api/php/lib/Model/CountComparisonOneOf5.php @@ -0,0 +1,421 @@ + + */ +class CountComparisonOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'CountComparison_oneOf_5'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'not_equal' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'not_equal' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'not_equal' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'not_equal' => 'NotEqual' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'not_equal' => 'setNotEqual' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'not_equal' => 'getNotEqual' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('not_equal', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['not_equal'] === null) { + $invalidProperties[] = "'not_equal' can't be null"; + } + if (($this->container['not_equal'] < 0)) { + $invalidProperties[] = "invalid value for 'not_equal', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets not_equal + * + * @return int + */ + public function getNotEqual() + { + return $this->container['not_equal']; + } + + /** + * Sets not_equal + * + * @param int $not_equal property != this + * + * @return self + */ + public function setNotEqual($not_equal) + { + if (is_null($not_equal)) { + throw new \InvalidArgumentException('non-nullable not_equal cannot be null'); + } + + if (($not_equal < 0)) { + throw new \InvalidArgumentException('invalid value for $not_equal when calling CountComparisonOneOf5., must be bigger than or equal to 0.'); + } + + $this->container['not_equal'] = $not_equal; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbElement.php b/agdb_api/php/lib/Model/DbElement.php new file mode 100644 index 00000000..40285074 --- /dev/null +++ b/agdb_api/php/lib/Model/DbElement.php @@ -0,0 +1,532 @@ + + */ +class DbElement implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbElement'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'int', + 'id' => 'int', + 'to' => 'int', + 'values' => '\Agnesoft\AgdbApi\Model\DbKeyValue[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => 'int64', + 'id' => 'int64', + 'to' => 'int64', + 'values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from' => true, + 'id' => false, + 'to' => true, + 'values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from' => 'from', + 'id' => 'id', + 'to' => 'to', + 'values' => 'values' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'id' => 'setId', + 'to' => 'setTo', + 'values' => 'setValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'id' => 'getId', + 'to' => 'getTo', + 'values' => 'getValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return int|null + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param int|null $from Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + array_push($this->openAPINullablesSetToNull, 'from'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('from', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets to + * + * @return int|null + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param int|null $to Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + array_push($this->openAPINullablesSetToNull, 'to'); + } else { + $nullablesSetToNull = $this->getOpenAPINullablesSetToNull(); + $index = array_search('to', $nullablesSetToNull); + if ($index !== FALSE) { + unset($nullablesSetToNull[$index]); + $this->setOpenAPINullablesSetToNull($nullablesSetToNull); + } + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets values + * + * @return \Agnesoft\AgdbApi\Model\DbKeyValue[] + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Agnesoft\AgdbApi\Model\DbKeyValue[] $values List of key-value pairs associated with the element. + * + * @return self + */ + public function setValues($values) + { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } + $this->container['values'] = $values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbKeyOrder.php b/agdb_api/php/lib/Model/DbKeyOrder.php new file mode 100644 index 00000000..2550e18f --- /dev/null +++ b/agdb_api/php/lib/Model/DbKeyOrder.php @@ -0,0 +1,450 @@ + + */ +class DbKeyOrder implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbKeyOrder'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asc' => '\Agnesoft\AgdbApi\Model\DbValue', + 'desc' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asc' => null, + 'desc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asc' => false, + 'desc' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'asc' => 'Asc', + 'desc' => 'Desc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asc' => 'setAsc', + 'desc' => 'setDesc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asc' => 'getAsc', + 'desc' => 'getDesc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('asc', $data ?? [], null); + $this->setIfExists('desc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['asc'] === null) { + $invalidProperties[] = "'asc' can't be null"; + } + if ($this->container['desc'] === null) { + $invalidProperties[] = "'desc' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets asc + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getAsc() + { + return $this->container['asc']; + } + + /** + * Sets asc + * + * @param \Agnesoft\AgdbApi\Model\DbValue $asc asc + * + * @return self + */ + public function setAsc($asc) + { + if (is_null($asc)) { + throw new \InvalidArgumentException('non-nullable asc cannot be null'); + } + $this->container['asc'] = $asc; + + return $this; + } + + /** + * Gets desc + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getDesc() + { + return $this->container['desc']; + } + + /** + * Sets desc + * + * @param \Agnesoft\AgdbApi\Model\DbValue $desc desc + * + * @return self + */ + public function setDesc($desc) + { + if (is_null($desc)) { + throw new \InvalidArgumentException('non-nullable desc cannot be null'); + } + $this->container['desc'] = $desc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbKeyOrderOneOf.php b/agdb_api/php/lib/Model/DbKeyOrderOneOf.php new file mode 100644 index 00000000..7ba7ccb9 --- /dev/null +++ b/agdb_api/php/lib/Model/DbKeyOrderOneOf.php @@ -0,0 +1,412 @@ + + */ +class DbKeyOrderOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbKeyOrder_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'asc' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'asc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'asc' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'asc' => 'Asc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'asc' => 'setAsc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'asc' => 'getAsc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('asc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['asc'] === null) { + $invalidProperties[] = "'asc' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets asc + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getAsc() + { + return $this->container['asc']; + } + + /** + * Sets asc + * + * @param \Agnesoft\AgdbApi\Model\DbValue $asc asc + * + * @return self + */ + public function setAsc($asc) + { + if (is_null($asc)) { + throw new \InvalidArgumentException('non-nullable asc cannot be null'); + } + $this->container['asc'] = $asc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbKeyOrderOneOf1.php b/agdb_api/php/lib/Model/DbKeyOrderOneOf1.php new file mode 100644 index 00000000..eba730b3 --- /dev/null +++ b/agdb_api/php/lib/Model/DbKeyOrderOneOf1.php @@ -0,0 +1,412 @@ + + */ +class DbKeyOrderOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbKeyOrder_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'desc' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'desc' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'desc' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'desc' => 'Desc' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'desc' => 'setDesc' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'desc' => 'getDesc' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('desc', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['desc'] === null) { + $invalidProperties[] = "'desc' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets desc + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getDesc() + { + return $this->container['desc']; + } + + /** + * Sets desc + * + * @param \Agnesoft\AgdbApi\Model\DbValue $desc desc + * + * @return self + */ + public function setDesc($desc) + { + if (is_null($desc)) { + throw new \InvalidArgumentException('non-nullable desc cannot be null'); + } + $this->container['desc'] = $desc; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbKeyValue.php b/agdb_api/php/lib/Model/DbKeyValue.php new file mode 100644 index 00000000..9dafa022 --- /dev/null +++ b/agdb_api/php/lib/Model/DbKeyValue.php @@ -0,0 +1,450 @@ + + */ +class DbKeyValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbKeyValue'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => '\Agnesoft\AgdbApi\Model\DbValue', + 'value' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'key' => 'key', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('key', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['key'] === null) { + $invalidProperties[] = "'key' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets key + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param \Agnesoft\AgdbApi\Model\DbValue $key key + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + throw new \InvalidArgumentException('non-nullable key cannot be null'); + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets value + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param \Agnesoft\AgdbApi\Model\DbValue $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbResource.php b/agdb_api/php/lib/Model/DbResource.php new file mode 100644 index 00000000..56bf8ed5 --- /dev/null +++ b/agdb_api/php/lib/Model/DbResource.php @@ -0,0 +1,68 @@ + + */ +class DbTypeParam implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbTypeParam'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'db_type' => '\Agnesoft\AgdbApi\Model\DbType' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'db_type' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'db_type' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'db_type' => 'db_type' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'db_type' => 'setDbType' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'db_type' => 'getDbType' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('db_type', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['db_type'] === null) { + $invalidProperties[] = "'db_type' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets db_type + * + * @return \Agnesoft\AgdbApi\Model\DbType + */ + public function getDbType() + { + return $this->container['db_type']; + } + + /** + * Sets db_type + * + * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type + * + * @return self + */ + public function setDbType($db_type) + { + if (is_null($db_type)) { + throw new \InvalidArgumentException('non-nullable db_type cannot be null'); + } + $this->container['db_type'] = $db_type; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbUser.php b/agdb_api/php/lib/Model/DbUser.php new file mode 100644 index 00000000..18725d76 --- /dev/null +++ b/agdb_api/php/lib/Model/DbUser.php @@ -0,0 +1,449 @@ + + */ +class DbUser implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbUser'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'role' => '\Agnesoft\AgdbApi\Model\DbUserRole', + 'user' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'role' => null, + 'user' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'role' => false, + 'user' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'role' => 'role', + 'user' => 'user' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'role' => 'setRole', + 'user' => 'setUser' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'role' => 'getRole', + 'user' => 'getUser' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['role'] === null) { + $invalidProperties[] = "'role' can't be null"; + } + if ($this->container['user'] === null) { + $invalidProperties[] = "'user' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets role + * + * @return \Agnesoft\AgdbApi\Model\DbUserRole + */ + public function getRole() + { + return $this->container['role']; + } + + /** + * Sets role + * + * @param \Agnesoft\AgdbApi\Model\DbUserRole $role role + * + * @return self + */ + public function setRole($role) + { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } + $this->container['role'] = $role; + + return $this; + } + + /** + * Gets user + * + * @return string + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string $user user + * + * @return self + */ + public function setUser($user) + { + if (is_null($user)) { + throw new \InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbUserRole.php b/agdb_api/php/lib/Model/DbUserRole.php new file mode 100644 index 00000000..065f9777 --- /dev/null +++ b/agdb_api/php/lib/Model/DbUserRole.php @@ -0,0 +1,65 @@ + + */ +class DbUserRoleParam implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbUserRoleParam'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'db_role' => '\Agnesoft\AgdbApi\Model\DbUserRole' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'db_role' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'db_role' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'db_role' => 'db_role' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'db_role' => 'setDbRole' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'db_role' => 'getDbRole' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('db_role', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['db_role'] === null) { + $invalidProperties[] = "'db_role' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets db_role + * + * @return \Agnesoft\AgdbApi\Model\DbUserRole + */ + public function getDbRole() + { + return $this->container['db_role']; + } + + /** + * Sets db_role + * + * @param \Agnesoft\AgdbApi\Model\DbUserRole $db_role db_role + * + * @return self + */ + public function setDbRole($db_role) + { + if (is_null($db_role)) { + throw new \InvalidArgumentException('non-nullable db_role cannot be null'); + } + $this->container['db_role'] = $db_role; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValue.php b/agdb_api/php/lib/Model/DbValue.php new file mode 100644 index 00000000..672d07a2 --- /dev/null +++ b/agdb_api/php/lib/Model/DbValue.php @@ -0,0 +1,718 @@ + + */ +class DbValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'bytes' => '\SplFileObject', + 'i64' => 'int', + 'u64' => 'int', + 'f64' => 'float', + 'string' => 'string', + 'vec_i64' => 'int[]', + 'vec_u64' => 'int[]', + 'vec_f64' => 'float[]', + 'vec_string' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'bytes' => 'binary', + 'i64' => 'int64', + 'u64' => 'int64', + 'f64' => 'double', + 'string' => null, + 'vec_i64' => 'int64', + 'vec_u64' => 'int64', + 'vec_f64' => 'double', + 'vec_string' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'bytes' => false, + 'i64' => false, + 'u64' => false, + 'f64' => false, + 'string' => false, + 'vec_i64' => false, + 'vec_u64' => false, + 'vec_f64' => false, + 'vec_string' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'bytes' => 'Bytes', + 'i64' => 'I64', + 'u64' => 'U64', + 'f64' => 'F64', + 'string' => 'String', + 'vec_i64' => 'VecI64', + 'vec_u64' => 'VecU64', + 'vec_f64' => 'VecF64', + 'vec_string' => 'VecString' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bytes' => 'setBytes', + 'i64' => 'setI64', + 'u64' => 'setU64', + 'f64' => 'setF64', + 'string' => 'setString', + 'vec_i64' => 'setVecI64', + 'vec_u64' => 'setVecU64', + 'vec_f64' => 'setVecF64', + 'vec_string' => 'setVecString' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bytes' => 'getBytes', + 'i64' => 'getI64', + 'u64' => 'getU64', + 'f64' => 'getF64', + 'string' => 'getString', + 'vec_i64' => 'getVecI64', + 'vec_u64' => 'getVecU64', + 'vec_f64' => 'getVecF64', + 'vec_string' => 'getVecString' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('bytes', $data ?? [], null); + $this->setIfExists('i64', $data ?? [], null); + $this->setIfExists('u64', $data ?? [], null); + $this->setIfExists('f64', $data ?? [], null); + $this->setIfExists('string', $data ?? [], null); + $this->setIfExists('vec_i64', $data ?? [], null); + $this->setIfExists('vec_u64', $data ?? [], null); + $this->setIfExists('vec_f64', $data ?? [], null); + $this->setIfExists('vec_string', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['bytes'] === null) { + $invalidProperties[] = "'bytes' can't be null"; + } + if ($this->container['i64'] === null) { + $invalidProperties[] = "'i64' can't be null"; + } + if ($this->container['u64'] === null) { + $invalidProperties[] = "'u64' can't be null"; + } + if (($this->container['u64'] < 0)) { + $invalidProperties[] = "invalid value for 'u64', must be bigger than or equal to 0."; + } + + if ($this->container['f64'] === null) { + $invalidProperties[] = "'f64' can't be null"; + } + if ($this->container['string'] === null) { + $invalidProperties[] = "'string' can't be null"; + } + if ($this->container['vec_i64'] === null) { + $invalidProperties[] = "'vec_i64' can't be null"; + } + if ($this->container['vec_u64'] === null) { + $invalidProperties[] = "'vec_u64' can't be null"; + } + if ($this->container['vec_f64'] === null) { + $invalidProperties[] = "'vec_f64' can't be null"; + } + if ($this->container['vec_string'] === null) { + $invalidProperties[] = "'vec_string' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets bytes + * + * @return \SplFileObject + */ + public function getBytes() + { + return $this->container['bytes']; + } + + /** + * Sets bytes + * + * @param \SplFileObject $bytes Byte array, sometimes referred to as blob + * + * @return self + */ + public function setBytes($bytes) + { + if (is_null($bytes)) { + throw new \InvalidArgumentException('non-nullable bytes cannot be null'); + } + $this->container['bytes'] = $bytes; + + return $this; + } + + /** + * Gets i64 + * + * @return int + */ + public function getI64() + { + return $this->container['i64']; + } + + /** + * Sets i64 + * + * @param int $i64 64-bit wide signed integer + * + * @return self + */ + public function setI64($i64) + { + if (is_null($i64)) { + throw new \InvalidArgumentException('non-nullable i64 cannot be null'); + } + $this->container['i64'] = $i64; + + return $this; + } + + /** + * Gets u64 + * + * @return int + */ + public function getU64() + { + return $this->container['u64']; + } + + /** + * Sets u64 + * + * @param int $u64 64-bit wide unsigned integer + * + * @return self + */ + public function setU64($u64) + { + if (is_null($u64)) { + throw new \InvalidArgumentException('non-nullable u64 cannot be null'); + } + + if (($u64 < 0)) { + throw new \InvalidArgumentException('invalid value for $u64 when calling DbValue., must be bigger than or equal to 0.'); + } + + $this->container['u64'] = $u64; + + return $this; + } + + /** + * Gets f64 + * + * @return float + */ + public function getF64() + { + return $this->container['f64']; + } + + /** + * Sets f64 + * + * @param float $f64 Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. + * + * @return self + */ + public function setF64($f64) + { + if (is_null($f64)) { + throw new \InvalidArgumentException('non-nullable f64 cannot be null'); + } + $this->container['f64'] = $f64; + + return $this; + } + + /** + * Gets string + * + * @return string + */ + public function getString() + { + return $this->container['string']; + } + + /** + * Sets string + * + * @param string $string UTF-8 string + * + * @return self + */ + public function setString($string) + { + if (is_null($string)) { + throw new \InvalidArgumentException('non-nullable string cannot be null'); + } + $this->container['string'] = $string; + + return $this; + } + + /** + * Gets vec_i64 + * + * @return int[] + */ + public function getVecI64() + { + return $this->container['vec_i64']; + } + + /** + * Sets vec_i64 + * + * @param int[] $vec_i64 List of 64-bit wide signed integers + * + * @return self + */ + public function setVecI64($vec_i64) + { + if (is_null($vec_i64)) { + throw new \InvalidArgumentException('non-nullable vec_i64 cannot be null'); + } + $this->container['vec_i64'] = $vec_i64; + + return $this; + } + + /** + * Gets vec_u64 + * + * @return int[] + */ + public function getVecU64() + { + return $this->container['vec_u64']; + } + + /** + * Sets vec_u64 + * + * @param int[] $vec_u64 List of 64-bit wide unsigned integers + * + * @return self + */ + public function setVecU64($vec_u64) + { + if (is_null($vec_u64)) { + throw new \InvalidArgumentException('non-nullable vec_u64 cannot be null'); + } + $this->container['vec_u64'] = $vec_u64; + + return $this; + } + + /** + * Gets vec_f64 + * + * @return float[] + */ + public function getVecF64() + { + return $this->container['vec_f64']; + } + + /** + * Sets vec_f64 + * + * @param float[] $vec_f64 List of 64-bit floating point numbers + * + * @return self + */ + public function setVecF64($vec_f64) + { + if (is_null($vec_f64)) { + throw new \InvalidArgumentException('non-nullable vec_f64 cannot be null'); + } + $this->container['vec_f64'] = $vec_f64; + + return $this; + } + + /** + * Gets vec_string + * + * @return string[] + */ + public function getVecString() + { + return $this->container['vec_string']; + } + + /** + * Sets vec_string + * + * @param string[] $vec_string List of UTF-8 strings + * + * @return self + */ + public function setVecString($vec_string) + { + if (is_null($vec_string)) { + throw new \InvalidArgumentException('non-nullable vec_string cannot be null'); + } + $this->container['vec_string'] = $vec_string; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf.php b/agdb_api/php/lib/Model/DbValueOneOf.php new file mode 100644 index 00000000..e7fa53ba --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'bytes' => '\SplFileObject' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'bytes' => 'binary' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'bytes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'bytes' => 'Bytes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'bytes' => 'setBytes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'bytes' => 'getBytes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('bytes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['bytes'] === null) { + $invalidProperties[] = "'bytes' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets bytes + * + * @return \SplFileObject + */ + public function getBytes() + { + return $this->container['bytes']; + } + + /** + * Sets bytes + * + * @param \SplFileObject $bytes Byte array, sometimes referred to as blob + * + * @return self + */ + public function setBytes($bytes) + { + if (is_null($bytes)) { + throw new \InvalidArgumentException('non-nullable bytes cannot be null'); + } + $this->container['bytes'] = $bytes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf1.php b/agdb_api/php/lib/Model/DbValueOneOf1.php new file mode 100644 index 00000000..654bcd3b --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf1.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'i64' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'i64' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'i64' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'i64' => 'I64' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'i64' => 'setI64' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'i64' => 'getI64' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('i64', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['i64'] === null) { + $invalidProperties[] = "'i64' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets i64 + * + * @return int + */ + public function getI64() + { + return $this->container['i64']; + } + + /** + * Sets i64 + * + * @param int $i64 64-bit wide signed integer + * + * @return self + */ + public function setI64($i64) + { + if (is_null($i64)) { + throw new \InvalidArgumentException('non-nullable i64 cannot be null'); + } + $this->container['i64'] = $i64; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf2.php b/agdb_api/php/lib/Model/DbValueOneOf2.php new file mode 100644 index 00000000..216325c2 --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf2.php @@ -0,0 +1,421 @@ + + */ +class DbValueOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'u64' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'u64' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'u64' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'u64' => 'U64' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'u64' => 'setU64' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'u64' => 'getU64' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('u64', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['u64'] === null) { + $invalidProperties[] = "'u64' can't be null"; + } + if (($this->container['u64'] < 0)) { + $invalidProperties[] = "invalid value for 'u64', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets u64 + * + * @return int + */ + public function getU64() + { + return $this->container['u64']; + } + + /** + * Sets u64 + * + * @param int $u64 64-bit wide unsigned integer + * + * @return self + */ + public function setU64($u64) + { + if (is_null($u64)) { + throw new \InvalidArgumentException('non-nullable u64 cannot be null'); + } + + if (($u64 < 0)) { + throw new \InvalidArgumentException('invalid value for $u64 when calling DbValueOneOf2., must be bigger than or equal to 0.'); + } + + $this->container['u64'] = $u64; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf3.php b/agdb_api/php/lib/Model/DbValueOneOf3.php new file mode 100644 index 00000000..e954fef3 --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf3.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_3'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'f64' => 'float' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'f64' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'f64' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'f64' => 'F64' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'f64' => 'setF64' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'f64' => 'getF64' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('f64', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['f64'] === null) { + $invalidProperties[] = "'f64' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets f64 + * + * @return float + */ + public function getF64() + { + return $this->container['f64']; + } + + /** + * Sets f64 + * + * @param float $f64 Database float is a wrapper around `f64` to provide functionality like comparison. The comparison is using `total_cmp` standard library function. See its [docs](https://doc.rust-lang.org/std/primitive.f64.html#method.total_cmp) to understand how it handles NaNs and other edge cases of floating point numbers. + * + * @return self + */ + public function setF64($f64) + { + if (is_null($f64)) { + throw new \InvalidArgumentException('non-nullable f64 cannot be null'); + } + $this->container['f64'] = $f64; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf4.php b/agdb_api/php/lib/Model/DbValueOneOf4.php new file mode 100644 index 00000000..d70e0514 --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf4.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_4'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'string' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'string' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'string' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'string' => 'String' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'string' => 'setString' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'string' => 'getString' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('string', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['string'] === null) { + $invalidProperties[] = "'string' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets string + * + * @return string + */ + public function getString() + { + return $this->container['string']; + } + + /** + * Sets string + * + * @param string $string UTF-8 string + * + * @return self + */ + public function setString($string) + { + if (is_null($string)) { + throw new \InvalidArgumentException('non-nullable string cannot be null'); + } + $this->container['string'] = $string; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf5.php b/agdb_api/php/lib/Model/DbValueOneOf5.php new file mode 100644 index 00000000..dd25a712 --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf5.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_5'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vec_i64' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vec_i64' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vec_i64' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'vec_i64' => 'VecI64' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vec_i64' => 'setVecI64' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vec_i64' => 'getVecI64' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('vec_i64', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['vec_i64'] === null) { + $invalidProperties[] = "'vec_i64' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets vec_i64 + * + * @return int[] + */ + public function getVecI64() + { + return $this->container['vec_i64']; + } + + /** + * Sets vec_i64 + * + * @param int[] $vec_i64 List of 64-bit wide signed integers + * + * @return self + */ + public function setVecI64($vec_i64) + { + if (is_null($vec_i64)) { + throw new \InvalidArgumentException('non-nullable vec_i64 cannot be null'); + } + $this->container['vec_i64'] = $vec_i64; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf6.php b/agdb_api/php/lib/Model/DbValueOneOf6.php new file mode 100644 index 00000000..b3769299 --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf6.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_6'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vec_u64' => 'int[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vec_u64' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vec_u64' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'vec_u64' => 'VecU64' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vec_u64' => 'setVecU64' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vec_u64' => 'getVecU64' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('vec_u64', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['vec_u64'] === null) { + $invalidProperties[] = "'vec_u64' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets vec_u64 + * + * @return int[] + */ + public function getVecU64() + { + return $this->container['vec_u64']; + } + + /** + * Sets vec_u64 + * + * @param int[] $vec_u64 List of 64-bit wide unsigned integers + * + * @return self + */ + public function setVecU64($vec_u64) + { + if (is_null($vec_u64)) { + throw new \InvalidArgumentException('non-nullable vec_u64 cannot be null'); + } + $this->container['vec_u64'] = $vec_u64; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf7.php b/agdb_api/php/lib/Model/DbValueOneOf7.php new file mode 100644 index 00000000..8d153749 --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf7.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf7 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_7'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vec_f64' => 'float[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vec_f64' => 'double' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vec_f64' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'vec_f64' => 'VecF64' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vec_f64' => 'setVecF64' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vec_f64' => 'getVecF64' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('vec_f64', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['vec_f64'] === null) { + $invalidProperties[] = "'vec_f64' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets vec_f64 + * + * @return float[] + */ + public function getVecF64() + { + return $this->container['vec_f64']; + } + + /** + * Sets vec_f64 + * + * @param float[] $vec_f64 List of 64-bit floating point numbers + * + * @return self + */ + public function setVecF64($vec_f64) + { + if (is_null($vec_f64)) { + throw new \InvalidArgumentException('non-nullable vec_f64 cannot be null'); + } + $this->container['vec_f64'] = $vec_f64; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/DbValueOneOf8.php b/agdb_api/php/lib/Model/DbValueOneOf8.php new file mode 100644 index 00000000..95b97e3f --- /dev/null +++ b/agdb_api/php/lib/Model/DbValueOneOf8.php @@ -0,0 +1,412 @@ + + */ +class DbValueOneOf8 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'DbValue_oneOf_8'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'vec_string' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'vec_string' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'vec_string' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'vec_string' => 'VecString' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'vec_string' => 'setVecString' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'vec_string' => 'getVecString' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('vec_string', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['vec_string'] === null) { + $invalidProperties[] = "'vec_string' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets vec_string + * + * @return string[] + */ + public function getVecString() + { + return $this->container['vec_string']; + } + + /** + * Sets vec_string + * + * @param string[] $vec_string List of UTF-8 strings + * + * @return self + */ + public function setVecString($vec_string) + { + if (is_null($vec_string)) { + throw new \InvalidArgumentException('non-nullable vec_string cannot be null'); + } + $this->container['vec_string'] = $vec_string; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/InsertAliasesQuery.php b/agdb_api/php/lib/Model/InsertAliasesQuery.php new file mode 100644 index 00000000..9706e946 --- /dev/null +++ b/agdb_api/php/lib/Model/InsertAliasesQuery.php @@ -0,0 +1,450 @@ + + */ +class InsertAliasesQuery implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InsertAliasesQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'aliases' => 'string[]', + 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'aliases' => null, + 'ids' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'aliases' => false, + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'aliases' => 'aliases', + 'ids' => 'ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'aliases' => 'setAliases', + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'aliases' => 'getAliases', + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('aliases', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['aliases'] === null) { + $invalidProperties[] = "'aliases' can't be null"; + } + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets aliases + * + * @return string[] + */ + public function getAliases() + { + return $this->container['aliases']; + } + + /** + * Sets aliases + * + * @param string[] $aliases Aliases to be inserted + * + * @return self + */ + public function setAliases($aliases) + { + if (is_null($aliases)) { + throw new \InvalidArgumentException('non-nullable aliases cannot be null'); + } + $this->container['aliases'] = $aliases; + + return $this; + } + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/InsertEdgesQuery.php b/agdb_api/php/lib/Model/InsertEdgesQuery.php new file mode 100644 index 00000000..22b9cd74 --- /dev/null +++ b/agdb_api/php/lib/Model/InsertEdgesQuery.php @@ -0,0 +1,561 @@ + + */ +class InsertEdgesQuery implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InsertEdgesQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'each' => 'bool', + 'from' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'to' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'values' => '\Agnesoft\AgdbApi\Model\QueryValues' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'each' => null, + 'from' => null, + 'ids' => null, + 'to' => null, + 'values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'each' => false, + 'from' => false, + 'ids' => false, + 'to' => false, + 'values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'each' => 'each', + 'from' => 'from', + 'ids' => 'ids', + 'to' => 'to', + 'values' => 'values' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'each' => 'setEach', + 'from' => 'setFrom', + 'ids' => 'setIds', + 'to' => 'setTo', + 'values' => 'setValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'each' => 'getEach', + 'from' => 'getFrom', + 'ids' => 'getIds', + 'to' => 'getTo', + 'values' => 'getValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('each', $data ?? [], null); + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['each'] === null) { + $invalidProperties[] = "'each' can't be null"; + } + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets each + * + * @return bool + */ + public function getEach() + { + return $this->container['each']; + } + + /** + * Sets each + * + * @param bool $each If `true` create an edge between each origin and destination. + * + * @return self + */ + public function setEach($each) + { + if (is_null($each)) { + throw new \InvalidArgumentException('non-nullable each cannot be null'); + } + $this->container['each'] = $each; + + return $this; + } + + /** + * Gets from + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $from from + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets to + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $to to + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + + /** + * Gets values + * + * @return \Agnesoft\AgdbApi\Model\QueryValues + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Agnesoft\AgdbApi\Model\QueryValues $values values + * + * @return self + */ + public function setValues($values) + { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } + $this->container['values'] = $values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/InsertNodesQuery.php b/agdb_api/php/lib/Model/InsertNodesQuery.php new file mode 100644 index 00000000..dec952ce --- /dev/null +++ b/agdb_api/php/lib/Model/InsertNodesQuery.php @@ -0,0 +1,533 @@ + + */ +class InsertNodesQuery implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InsertNodesQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'aliases' => 'string[]', + 'count' => 'int', + 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'values' => '\Agnesoft\AgdbApi\Model\QueryValues' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'aliases' => null, + 'count' => 'int64', + 'ids' => null, + 'values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'aliases' => false, + 'count' => false, + 'ids' => false, + 'values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'aliases' => 'aliases', + 'count' => 'count', + 'ids' => 'ids', + 'values' => 'values' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'aliases' => 'setAliases', + 'count' => 'setCount', + 'ids' => 'setIds', + 'values' => 'setValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'aliases' => 'getAliases', + 'count' => 'getCount', + 'ids' => 'getIds', + 'values' => 'getValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('aliases', $data ?? [], null); + $this->setIfExists('count', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['aliases'] === null) { + $invalidProperties[] = "'aliases' can't be null"; + } + if ($this->container['count'] === null) { + $invalidProperties[] = "'count' can't be null"; + } + if (($this->container['count'] < 0)) { + $invalidProperties[] = "invalid value for 'count', must be bigger than or equal to 0."; + } + + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets aliases + * + * @return string[] + */ + public function getAliases() + { + return $this->container['aliases']; + } + + /** + * Sets aliases + * + * @param string[] $aliases Aliases of the new nodes. + * + * @return self + */ + public function setAliases($aliases) + { + if (is_null($aliases)) { + throw new \InvalidArgumentException('non-nullable aliases cannot be null'); + } + $this->container['aliases'] = $aliases; + + return $this; + } + + /** + * Gets count + * + * @return int + */ + public function getCount() + { + return $this->container['count']; + } + + /** + * Sets count + * + * @param int $count Number of nodes to be inserted. + * + * @return self + */ + public function setCount($count) + { + if (is_null($count)) { + throw new \InvalidArgumentException('non-nullable count cannot be null'); + } + + if (($count < 0)) { + throw new \InvalidArgumentException('invalid value for $count when calling InsertNodesQuery., must be bigger than or equal to 0.'); + } + + $this->container['count'] = $count; + + return $this; + } + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets values + * + * @return \Agnesoft\AgdbApi\Model\QueryValues + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Agnesoft\AgdbApi\Model\QueryValues $values values + * + * @return self + */ + public function setValues($values) + { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } + $this->container['values'] = $values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/InsertValuesQuery.php b/agdb_api/php/lib/Model/InsertValuesQuery.php new file mode 100644 index 00000000..39716f65 --- /dev/null +++ b/agdb_api/php/lib/Model/InsertValuesQuery.php @@ -0,0 +1,450 @@ + + */ +class InsertValuesQuery implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'InsertValuesQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'values' => '\Agnesoft\AgdbApi\Model\QueryValues' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => false, + 'values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ids' => 'ids', + 'values' => 'values' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'values' => 'setValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'values' => 'getValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + if ($this->container['values'] === null) { + $invalidProperties[] = "'values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets values + * + * @return \Agnesoft\AgdbApi\Model\QueryValues + */ + public function getValues() + { + return $this->container['values']; + } + + /** + * Sets values + * + * @param \Agnesoft\AgdbApi\Model\QueryValues $values values + * + * @return self + */ + public function setValues($values) + { + if (is_null($values)) { + throw new \InvalidArgumentException('non-nullable values cannot be null'); + } + $this->container['values'] = $values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ModelInterface.php b/agdb_api/php/lib/Model/ModelInterface.php new file mode 100644 index 00000000..36715eee --- /dev/null +++ b/agdb_api/php/lib/Model/ModelInterface.php @@ -0,0 +1,111 @@ + + */ +class QueryAudit implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryAudit'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'query' => '\Agnesoft\AgdbApi\Model\QueryType', + 'timestamp' => 'int', + 'user' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'query' => null, + 'timestamp' => 'int64', + 'user' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'query' => false, + 'timestamp' => false, + 'user' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'query' => 'query', + 'timestamp' => 'timestamp', + 'user' => 'user' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'query' => 'setQuery', + 'timestamp' => 'setTimestamp', + 'user' => 'setUser' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'query' => 'getQuery', + 'timestamp' => 'getTimestamp', + 'user' => 'getUser' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('query', $data ?? [], null); + $this->setIfExists('timestamp', $data ?? [], null); + $this->setIfExists('user', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['query'] === null) { + $invalidProperties[] = "'query' can't be null"; + } + if ($this->container['timestamp'] === null) { + $invalidProperties[] = "'timestamp' can't be null"; + } + if (($this->container['timestamp'] < 0)) { + $invalidProperties[] = "invalid value for 'timestamp', must be bigger than or equal to 0."; + } + + if ($this->container['user'] === null) { + $invalidProperties[] = "'user' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets query + * + * @return \Agnesoft\AgdbApi\Model\QueryType + */ + public function getQuery() + { + return $this->container['query']; + } + + /** + * Sets query + * + * @param \Agnesoft\AgdbApi\Model\QueryType $query query + * + * @return self + */ + public function setQuery($query) + { + if (is_null($query)) { + throw new \InvalidArgumentException('non-nullable query cannot be null'); + } + $this->container['query'] = $query; + + return $this; + } + + /** + * Gets timestamp + * + * @return int + */ + public function getTimestamp() + { + return $this->container['timestamp']; + } + + /** + * Sets timestamp + * + * @param int $timestamp timestamp + * + * @return self + */ + public function setTimestamp($timestamp) + { + if (is_null($timestamp)) { + throw new \InvalidArgumentException('non-nullable timestamp cannot be null'); + } + + if (($timestamp < 0)) { + throw new \InvalidArgumentException('invalid value for $timestamp when calling QueryAudit., must be bigger than or equal to 0.'); + } + + $this->container['timestamp'] = $timestamp; + + return $this; + } + + /** + * Gets user + * + * @return string + */ + public function getUser() + { + return $this->container['user']; + } + + /** + * Sets user + * + * @param string $user user + * + * @return self + */ + public function setUser($user) + { + if (is_null($user)) { + throw new \InvalidArgumentException('non-nullable user cannot be null'); + } + $this->container['user'] = $user; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryCondition.php b/agdb_api/php/lib/Model/QueryCondition.php new file mode 100644 index 00000000..d84073c1 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryCondition.php @@ -0,0 +1,487 @@ + + */ +class QueryCondition implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryCondition'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'data' => '\Agnesoft\AgdbApi\Model\QueryConditionData', + 'logic' => '\Agnesoft\AgdbApi\Model\QueryConditionLogic', + 'modifier' => '\Agnesoft\AgdbApi\Model\QueryConditionModifier' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'data' => null, + 'logic' => null, + 'modifier' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'data' => false, + 'logic' => false, + 'modifier' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'data' => 'data', + 'logic' => 'logic', + 'modifier' => 'modifier' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'data' => 'setData', + 'logic' => 'setLogic', + 'modifier' => 'setModifier' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'data' => 'getData', + 'logic' => 'getLogic', + 'modifier' => 'getModifier' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('data', $data ?? [], null); + $this->setIfExists('logic', $data ?? [], null); + $this->setIfExists('modifier', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['data'] === null) { + $invalidProperties[] = "'data' can't be null"; + } + if ($this->container['logic'] === null) { + $invalidProperties[] = "'logic' can't be null"; + } + if ($this->container['modifier'] === null) { + $invalidProperties[] = "'modifier' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets data + * + * @return \Agnesoft\AgdbApi\Model\QueryConditionData + */ + public function getData() + { + return $this->container['data']; + } + + /** + * Sets data + * + * @param \Agnesoft\AgdbApi\Model\QueryConditionData $data data + * + * @return self + */ + public function setData($data) + { + if (is_null($data)) { + throw new \InvalidArgumentException('non-nullable data cannot be null'); + } + $this->container['data'] = $data; + + return $this; + } + + /** + * Gets logic + * + * @return \Agnesoft\AgdbApi\Model\QueryConditionLogic + */ + public function getLogic() + { + return $this->container['logic']; + } + + /** + * Sets logic + * + * @param \Agnesoft\AgdbApi\Model\QueryConditionLogic $logic logic + * + * @return self + */ + public function setLogic($logic) + { + if (is_null($logic)) { + throw new \InvalidArgumentException('non-nullable logic cannot be null'); + } + $this->container['logic'] = $logic; + + return $this; + } + + /** + * Gets modifier + * + * @return \Agnesoft\AgdbApi\Model\QueryConditionModifier + */ + public function getModifier() + { + return $this->container['modifier']; + } + + /** + * Sets modifier + * + * @param \Agnesoft\AgdbApi\Model\QueryConditionModifier $modifier modifier + * + * @return self + */ + public function setModifier($modifier) + { + if (is_null($modifier)) { + throw new \InvalidArgumentException('non-nullable modifier cannot be null'); + } + $this->container['modifier'] = $modifier; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionData.php b/agdb_api/php/lib/Model/QueryConditionData.php new file mode 100644 index 00000000..4597bf02 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionData.php @@ -0,0 +1,672 @@ + + */ +class QueryConditionData implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'distance' => '\Agnesoft\AgdbApi\Model\CountComparison', + 'edge_count' => '\Agnesoft\AgdbApi\Model\CountComparison', + 'edge_count_from' => '\Agnesoft\AgdbApi\Model\CountComparison', + 'edge_count_to' => '\Agnesoft\AgdbApi\Model\CountComparison', + 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]', + 'key_value' => '\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue', + 'keys' => '\Agnesoft\AgdbApi\Model\DbValue[]', + 'where' => '\Agnesoft\AgdbApi\Model\QueryCondition[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'distance' => null, + 'edge_count' => null, + 'edge_count_from' => null, + 'edge_count_to' => null, + 'ids' => null, + 'key_value' => null, + 'keys' => null, + 'where' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'distance' => false, + 'edge_count' => false, + 'edge_count_from' => false, + 'edge_count_to' => false, + 'ids' => false, + 'key_value' => false, + 'keys' => false, + 'where' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'distance' => 'Distance', + 'edge_count' => 'EdgeCount', + 'edge_count_from' => 'EdgeCountFrom', + 'edge_count_to' => 'EdgeCountTo', + 'ids' => 'Ids', + 'key_value' => 'KeyValue', + 'keys' => 'Keys', + 'where' => 'Where' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'distance' => 'setDistance', + 'edge_count' => 'setEdgeCount', + 'edge_count_from' => 'setEdgeCountFrom', + 'edge_count_to' => 'setEdgeCountTo', + 'ids' => 'setIds', + 'key_value' => 'setKeyValue', + 'keys' => 'setKeys', + 'where' => 'setWhere' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'distance' => 'getDistance', + 'edge_count' => 'getEdgeCount', + 'edge_count_from' => 'getEdgeCountFrom', + 'edge_count_to' => 'getEdgeCountTo', + 'ids' => 'getIds', + 'key_value' => 'getKeyValue', + 'keys' => 'getKeys', + 'where' => 'getWhere' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('distance', $data ?? [], null); + $this->setIfExists('edge_count', $data ?? [], null); + $this->setIfExists('edge_count_from', $data ?? [], null); + $this->setIfExists('edge_count_to', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('key_value', $data ?? [], null); + $this->setIfExists('keys', $data ?? [], null); + $this->setIfExists('where', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['distance'] === null) { + $invalidProperties[] = "'distance' can't be null"; + } + if ($this->container['edge_count'] === null) { + $invalidProperties[] = "'edge_count' can't be null"; + } + if ($this->container['edge_count_from'] === null) { + $invalidProperties[] = "'edge_count_from' can't be null"; + } + if ($this->container['edge_count_to'] === null) { + $invalidProperties[] = "'edge_count_to' can't be null"; + } + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + if ($this->container['key_value'] === null) { + $invalidProperties[] = "'key_value' can't be null"; + } + if ($this->container['keys'] === null) { + $invalidProperties[] = "'keys' can't be null"; + } + if ($this->container['where'] === null) { + $invalidProperties[] = "'where' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets distance + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getDistance() + { + return $this->container['distance']; + } + + /** + * Sets distance + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $distance distance + * + * @return self + */ + public function setDistance($distance) + { + if (is_null($distance)) { + throw new \InvalidArgumentException('non-nullable distance cannot be null'); + } + $this->container['distance'] = $distance; + + return $this; + } + + /** + * Gets edge_count + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getEdgeCount() + { + return $this->container['edge_count']; + } + + /** + * Sets edge_count + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count edge_count + * + * @return self + */ + public function setEdgeCount($edge_count) + { + if (is_null($edge_count)) { + throw new \InvalidArgumentException('non-nullable edge_count cannot be null'); + } + $this->container['edge_count'] = $edge_count; + + return $this; + } + + /** + * Gets edge_count_from + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getEdgeCountFrom() + { + return $this->container['edge_count_from']; + } + + /** + * Sets edge_count_from + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_from edge_count_from + * + * @return self + */ + public function setEdgeCountFrom($edge_count_from) + { + if (is_null($edge_count_from)) { + throw new \InvalidArgumentException('non-nullable edge_count_from cannot be null'); + } + $this->container['edge_count_from'] = $edge_count_from; + + return $this; + } + + /** + * Gets edge_count_to + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getEdgeCountTo() + { + return $this->container['edge_count_to']; + } + + /** + * Sets edge_count_to + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_to edge_count_to + * + * @return self + */ + public function setEdgeCountTo($edge_count_to) + { + if (is_null($edge_count_to)) { + throw new \InvalidArgumentException('non-nullable edge_count_to cannot be null'); + } + $this->container['edge_count_to'] = $edge_count_to; + + return $this; + } + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryId[] + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids Tests if the current id is in the list of ids. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets key_value + * + * @return \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue + */ + public function getKeyValue() + { + return $this->container['key_value']; + } + + /** + * Sets key_value + * + * @param \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue $key_value key_value + * + * @return self + */ + public function setKeyValue($key_value) + { + if (is_null($key_value)) { + throw new \InvalidArgumentException('non-nullable key_value cannot be null'); + } + $this->container['key_value'] = $key_value; + + return $this; + } + + /** + * Gets keys + * + * @return \Agnesoft\AgdbApi\Model\DbValue[] + */ + public function getKeys() + { + return $this->container['keys']; + } + + /** + * Sets keys + * + * @param \Agnesoft\AgdbApi\Model\DbValue[] $keys Test if the current element has **all** of the keys listed. + * + * @return self + */ + public function setKeys($keys) + { + if (is_null($keys)) { + throw new \InvalidArgumentException('non-nullable keys cannot be null'); + } + $this->container['keys'] = $keys; + + return $this; + } + + /** + * Gets where + * + * @return \Agnesoft\AgdbApi\Model\QueryCondition[] + */ + public function getWhere() + { + return $this->container['where']; + } + + /** + * Sets where + * + * @param \Agnesoft\AgdbApi\Model\QueryCondition[] $where Nested list of conditions (equivalent to brackets). + * + * @return self + */ + public function setWhere($where) + { + if (is_null($where)) { + throw new \InvalidArgumentException('non-nullable where cannot be null'); + } + $this->container['where'] = $where; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf.php new file mode 100644 index 00000000..9920a9be --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'distance' => '\Agnesoft\AgdbApi\Model\CountComparison' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'distance' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'distance' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'distance' => 'Distance' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'distance' => 'setDistance' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'distance' => 'getDistance' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('distance', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['distance'] === null) { + $invalidProperties[] = "'distance' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets distance + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getDistance() + { + return $this->container['distance']; + } + + /** + * Sets distance + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $distance distance + * + * @return self + */ + public function setDistance($distance) + { + if (is_null($distance)) { + throw new \InvalidArgumentException('non-nullable distance cannot be null'); + } + $this->container['distance'] = $distance; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf1.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf1.php new file mode 100644 index 00000000..872d962f --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf1.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'edge_count' => '\Agnesoft\AgdbApi\Model\CountComparison' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'edge_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'edge_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'edge_count' => 'EdgeCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'edge_count' => 'setEdgeCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'edge_count' => 'getEdgeCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('edge_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['edge_count'] === null) { + $invalidProperties[] = "'edge_count' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets edge_count + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getEdgeCount() + { + return $this->container['edge_count']; + } + + /** + * Sets edge_count + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count edge_count + * + * @return self + */ + public function setEdgeCount($edge_count) + { + if (is_null($edge_count)) { + throw new \InvalidArgumentException('non-nullable edge_count cannot be null'); + } + $this->container['edge_count'] = $edge_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf2.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf2.php new file mode 100644 index 00000000..3cc441c3 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf2.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'edge_count_from' => '\Agnesoft\AgdbApi\Model\CountComparison' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'edge_count_from' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'edge_count_from' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'edge_count_from' => 'EdgeCountFrom' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'edge_count_from' => 'setEdgeCountFrom' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'edge_count_from' => 'getEdgeCountFrom' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('edge_count_from', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['edge_count_from'] === null) { + $invalidProperties[] = "'edge_count_from' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets edge_count_from + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getEdgeCountFrom() + { + return $this->container['edge_count_from']; + } + + /** + * Sets edge_count_from + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_from edge_count_from + * + * @return self + */ + public function setEdgeCountFrom($edge_count_from) + { + if (is_null($edge_count_from)) { + throw new \InvalidArgumentException('non-nullable edge_count_from cannot be null'); + } + $this->container['edge_count_from'] = $edge_count_from; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf3.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf3.php new file mode 100644 index 00000000..33d106ba --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf3.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_3'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'edge_count_to' => '\Agnesoft\AgdbApi\Model\CountComparison' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'edge_count_to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'edge_count_to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'edge_count_to' => 'EdgeCountTo' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'edge_count_to' => 'setEdgeCountTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'edge_count_to' => 'getEdgeCountTo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('edge_count_to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['edge_count_to'] === null) { + $invalidProperties[] = "'edge_count_to' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets edge_count_to + * + * @return \Agnesoft\AgdbApi\Model\CountComparison + */ + public function getEdgeCountTo() + { + return $this->container['edge_count_to']; + } + + /** + * Sets edge_count_to + * + * @param \Agnesoft\AgdbApi\Model\CountComparison $edge_count_to edge_count_to + * + * @return self + */ + public function setEdgeCountTo($edge_count_to) + { + if (is_null($edge_count_to)) { + throw new \InvalidArgumentException('non-nullable edge_count_to cannot be null'); + } + $this->container['edge_count_to'] = $edge_count_to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf4.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf4.php new file mode 100644 index 00000000..f8247365 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf4.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_4'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ids' => 'Ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryId[] + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids Tests if the current id is in the list of ids. + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf5.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf5.php new file mode 100644 index 00000000..42424d7d --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf5.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_5'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key_value' => '\Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key_value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key_value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'key_value' => 'KeyValue' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key_value' => 'setKeyValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key_value' => 'getKeyValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('key_value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['key_value'] === null) { + $invalidProperties[] = "'key_value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets key_value + * + * @return \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue + */ + public function getKeyValue() + { + return $this->container['key_value']; + } + + /** + * Sets key_value + * + * @param \Agnesoft\AgdbApi\Model\QueryConditionDataOneOf5KeyValue $key_value key_value + * + * @return self + */ + public function setKeyValue($key_value) + { + if (is_null($key_value)) { + throw new \InvalidArgumentException('non-nullable key_value cannot be null'); + } + $this->container['key_value'] = $key_value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php new file mode 100644 index 00000000..b6834813 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf5KeyValue.php @@ -0,0 +1,450 @@ + + */ +class QueryConditionDataOneOf5KeyValue implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_5_KeyValue'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'key' => '\Agnesoft\AgdbApi\Model\DbValue', + 'value' => '\Agnesoft\AgdbApi\Model\Comparison' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'key' => null, + 'value' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'key' => false, + 'value' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'key' => 'key', + 'value' => 'value' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'key' => 'setKey', + 'value' => 'setValue' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'key' => 'getKey', + 'value' => 'getValue' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('key', $data ?? [], null); + $this->setIfExists('value', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['key'] === null) { + $invalidProperties[] = "'key' can't be null"; + } + if ($this->container['value'] === null) { + $invalidProperties[] = "'value' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets key + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getKey() + { + return $this->container['key']; + } + + /** + * Sets key + * + * @param \Agnesoft\AgdbApi\Model\DbValue $key key + * + * @return self + */ + public function setKey($key) + { + if (is_null($key)) { + throw new \InvalidArgumentException('non-nullable key cannot be null'); + } + $this->container['key'] = $key; + + return $this; + } + + /** + * Gets value + * + * @return \Agnesoft\AgdbApi\Model\Comparison + */ + public function getValue() + { + return $this->container['value']; + } + + /** + * Sets value + * + * @param \Agnesoft\AgdbApi\Model\Comparison $value value + * + * @return self + */ + public function setValue($value) + { + if (is_null($value)) { + throw new \InvalidArgumentException('non-nullable value cannot be null'); + } + $this->container['value'] = $value; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf6.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf6.php new file mode 100644 index 00000000..0b732b19 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf6.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_6'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'keys' => '\Agnesoft\AgdbApi\Model\DbValue[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'keys' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'keys' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'keys' => 'Keys' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'keys' => 'setKeys' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'keys' => 'getKeys' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('keys', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['keys'] === null) { + $invalidProperties[] = "'keys' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets keys + * + * @return \Agnesoft\AgdbApi\Model\DbValue[] + */ + public function getKeys() + { + return $this->container['keys']; + } + + /** + * Sets keys + * + * @param \Agnesoft\AgdbApi\Model\DbValue[] $keys Test if the current element has **all** of the keys listed. + * + * @return self + */ + public function setKeys($keys) + { + if (is_null($keys)) { + throw new \InvalidArgumentException('non-nullable keys cannot be null'); + } + $this->container['keys'] = $keys; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionDataOneOf7.php b/agdb_api/php/lib/Model/QueryConditionDataOneOf7.php new file mode 100644 index 00000000..3a115706 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionDataOneOf7.php @@ -0,0 +1,412 @@ + + */ +class QueryConditionDataOneOf7 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryConditionData_oneOf_7'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'where' => '\Agnesoft\AgdbApi\Model\QueryCondition[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'where' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'where' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'where' => 'Where' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'where' => 'setWhere' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'where' => 'getWhere' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('where', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['where'] === null) { + $invalidProperties[] = "'where' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets where + * + * @return \Agnesoft\AgdbApi\Model\QueryCondition[] + */ + public function getWhere() + { + return $this->container['where']; + } + + /** + * Sets where + * + * @param \Agnesoft\AgdbApi\Model\QueryCondition[] $where Nested list of conditions (equivalent to brackets). + * + * @return self + */ + public function setWhere($where) + { + if (is_null($where)) { + throw new \InvalidArgumentException('non-nullable where cannot be null'); + } + $this->container['where'] = $where; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryConditionLogic.php b/agdb_api/php/lib/Model/QueryConditionLogic.php new file mode 100644 index 00000000..0f970f9e --- /dev/null +++ b/agdb_api/php/lib/Model/QueryConditionLogic.php @@ -0,0 +1,63 @@ + + */ +class QueryId implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryId'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int', + 'alias' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'int64', + 'alias' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false, + 'alias' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'Id', + 'alias' => 'Alias' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId', + 'alias' => 'setAlias' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId', + 'alias' => 'getAlias' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + $this->setIfExists('alias', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + if ($this->container['alias'] === null) { + $invalidProperties[] = "'alias' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + + /** + * Gets alias + * + * @return string + */ + public function getAlias() + { + return $this->container['alias']; + } + + /** + * Sets alias + * + * @param string $alias String alias + * + * @return self + */ + public function setAlias($alias) + { + if (is_null($alias)) { + throw new \InvalidArgumentException('non-nullable alias cannot be null'); + } + $this->container['alias'] = $alias; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryIdOneOf.php b/agdb_api/php/lib/Model/QueryIdOneOf.php new file mode 100644 index 00000000..d62bf3fa --- /dev/null +++ b/agdb_api/php/lib/Model/QueryIdOneOf.php @@ -0,0 +1,412 @@ + + */ +class QueryIdOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryId_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'id' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'id' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'id' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'id' => 'Id' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'id' => 'setId' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'id' => 'getId' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('id', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['id'] === null) { + $invalidProperties[] = "'id' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets id + * + * @return int + */ + public function getId() + { + return $this->container['id']; + } + + /** + * Sets id + * + * @param int $id Database id is a wrapper around `i64`. The id is an identifier of a database element both nodes and edges. The positive ids represent nodes, negative ids represent edges. The value of `0` is logically invalid (there cannot be element with id 0) and a default. + * + * @return self + */ + public function setId($id) + { + if (is_null($id)) { + throw new \InvalidArgumentException('non-nullable id cannot be null'); + } + $this->container['id'] = $id; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryIdOneOf1.php b/agdb_api/php/lib/Model/QueryIdOneOf1.php new file mode 100644 index 00000000..c18d4c58 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryIdOneOf1.php @@ -0,0 +1,412 @@ + + */ +class QueryIdOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryId_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'alias' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'alias' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'alias' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'alias' => 'Alias' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'alias' => 'setAlias' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'alias' => 'getAlias' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('alias', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['alias'] === null) { + $invalidProperties[] = "'alias' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets alias + * + * @return string + */ + public function getAlias() + { + return $this->container['alias']; + } + + /** + * Sets alias + * + * @param string $alias String alias + * + * @return self + */ + public function setAlias($alias) + { + if (is_null($alias)) { + throw new \InvalidArgumentException('non-nullable alias cannot be null'); + } + $this->container['alias'] = $alias; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryIds.php b/agdb_api/php/lib/Model/QueryIds.php new file mode 100644 index 00000000..2a128593 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryIds.php @@ -0,0 +1,450 @@ + + */ +class QueryIds implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryIds'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]', + 'search' => '\Agnesoft\AgdbApi\Model\SearchQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'search' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => false, + 'search' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ids' => 'Ids', + 'search' => 'Search' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'search' => 'setSearch' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'search' => 'getSearch' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('search', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + if ($this->container['search'] === null) { + $invalidProperties[] = "'search' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryId[] + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids List of [`QueryId`]s + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets search + * + * @return \Agnesoft\AgdbApi\Model\SearchQuery + */ + public function getSearch() + { + return $this->container['search']; + } + + /** + * Sets search + * + * @param \Agnesoft\AgdbApi\Model\SearchQuery $search search + * + * @return self + */ + public function setSearch($search) + { + if (is_null($search)) { + throw new \InvalidArgumentException('non-nullable search cannot be null'); + } + $this->container['search'] = $search; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryIdsOneOf.php b/agdb_api/php/lib/Model/QueryIdsOneOf.php new file mode 100644 index 00000000..d57a7d8a --- /dev/null +++ b/agdb_api/php/lib/Model/QueryIdsOneOf.php @@ -0,0 +1,412 @@ + + */ +class QueryIdsOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryIds_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => '\Agnesoft\AgdbApi\Model\QueryId[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ids' => 'Ids' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryId[] + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryId[] $ids List of [`QueryId`]s + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryIdsOneOf1.php b/agdb_api/php/lib/Model/QueryIdsOneOf1.php new file mode 100644 index 00000000..fffd1e8f --- /dev/null +++ b/agdb_api/php/lib/Model/QueryIdsOneOf1.php @@ -0,0 +1,412 @@ + + */ +class QueryIdsOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryIds_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'search' => '\Agnesoft\AgdbApi\Model\SearchQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'search' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'search' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'search' => 'Search' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'search' => 'setSearch' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'search' => 'getSearch' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('search', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['search'] === null) { + $invalidProperties[] = "'search' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets search + * + * @return \Agnesoft\AgdbApi\Model\SearchQuery + */ + public function getSearch() + { + return $this->container['search']; + } + + /** + * Sets search + * + * @param \Agnesoft\AgdbApi\Model\SearchQuery $search search + * + * @return self + */ + public function setSearch($search) + { + if (is_null($search)) { + throw new \InvalidArgumentException('non-nullable search cannot be null'); + } + $this->container['search'] = $search; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryResult.php b/agdb_api/php/lib/Model/QueryResult.php new file mode 100644 index 00000000..c33ccd29 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryResult.php @@ -0,0 +1,450 @@ + + */ +class QueryResult implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryResult'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'elements' => '\Agnesoft\AgdbApi\Model\DbElement[]', + 'result' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'elements' => null, + 'result' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'elements' => false, + 'result' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'elements' => 'elements', + 'result' => 'result' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'elements' => 'setElements', + 'result' => 'setResult' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'elements' => 'getElements', + 'result' => 'getResult' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('elements', $data ?? [], null); + $this->setIfExists('result', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['elements'] === null) { + $invalidProperties[] = "'elements' can't be null"; + } + if ($this->container['result'] === null) { + $invalidProperties[] = "'result' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets elements + * + * @return \Agnesoft\AgdbApi\Model\DbElement[] + */ + public function getElements() + { + return $this->container['elements']; + } + + /** + * Sets elements + * + * @param \Agnesoft\AgdbApi\Model\DbElement[] $elements List of elements yielded by the query possibly with a list of properties. + * + * @return self + */ + public function setElements($elements) + { + if (is_null($elements)) { + throw new \InvalidArgumentException('non-nullable elements cannot be null'); + } + $this->container['elements'] = $elements; + + return $this; + } + + /** + * Gets result + * + * @return int + */ + public function getResult() + { + return $this->container['result']; + } + + /** + * Sets result + * + * @param int $result Query result + * + * @return self + */ + public function setResult($result) + { + if (is_null($result)) { + throw new \InvalidArgumentException('non-nullable result cannot be null'); + } + $this->container['result'] = $result; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryType.php b/agdb_api/php/lib/Model/QueryType.php new file mode 100644 index 00000000..88ca2e19 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryType.php @@ -0,0 +1,1042 @@ + + */ +class QueryType implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'insert_alias' => '\Agnesoft\AgdbApi\Model\InsertAliasesQuery', + 'insert_edges' => '\Agnesoft\AgdbApi\Model\InsertEdgesQuery', + 'insert_index' => '\Agnesoft\AgdbApi\Model\DbValue', + 'insert_nodes' => '\Agnesoft\AgdbApi\Model\InsertNodesQuery', + 'insert_values' => '\Agnesoft\AgdbApi\Model\InsertValuesQuery', + 'remove' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'remove_aliases' => 'string[]', + 'remove_index' => '\Agnesoft\AgdbApi\Model\DbValue', + 'remove_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery', + 'search' => '\Agnesoft\AgdbApi\Model\SearchQuery', + 'select_aliases' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'select_all_aliases' => 'object', + 'select_edge_count' => '\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery', + 'select_indexes' => 'object', + 'select_keys' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'select_key_count' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'select_node_count' => 'object', + 'select_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'insert_alias' => null, + 'insert_edges' => null, + 'insert_index' => null, + 'insert_nodes' => null, + 'insert_values' => null, + 'remove' => null, + 'remove_aliases' => null, + 'remove_index' => null, + 'remove_values' => null, + 'search' => null, + 'select_aliases' => null, + 'select_all_aliases' => null, + 'select_edge_count' => null, + 'select_indexes' => null, + 'select_keys' => null, + 'select_key_count' => null, + 'select_node_count' => null, + 'select_values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'insert_alias' => false, + 'insert_edges' => false, + 'insert_index' => false, + 'insert_nodes' => false, + 'insert_values' => false, + 'remove' => false, + 'remove_aliases' => false, + 'remove_index' => false, + 'remove_values' => false, + 'search' => false, + 'select_aliases' => false, + 'select_all_aliases' => false, + 'select_edge_count' => false, + 'select_indexes' => false, + 'select_keys' => false, + 'select_key_count' => false, + 'select_node_count' => false, + 'select_values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'insert_alias' => 'InsertAlias', + 'insert_edges' => 'InsertEdges', + 'insert_index' => 'InsertIndex', + 'insert_nodes' => 'InsertNodes', + 'insert_values' => 'InsertValues', + 'remove' => 'Remove', + 'remove_aliases' => 'RemoveAliases', + 'remove_index' => 'RemoveIndex', + 'remove_values' => 'RemoveValues', + 'search' => 'Search', + 'select_aliases' => 'SelectAliases', + 'select_all_aliases' => 'SelectAllAliases', + 'select_edge_count' => 'SelectEdgeCount', + 'select_indexes' => 'SelectIndexes', + 'select_keys' => 'SelectKeys', + 'select_key_count' => 'SelectKeyCount', + 'select_node_count' => 'SelectNodeCount', + 'select_values' => 'SelectValues' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'insert_alias' => 'setInsertAlias', + 'insert_edges' => 'setInsertEdges', + 'insert_index' => 'setInsertIndex', + 'insert_nodes' => 'setInsertNodes', + 'insert_values' => 'setInsertValues', + 'remove' => 'setRemove', + 'remove_aliases' => 'setRemoveAliases', + 'remove_index' => 'setRemoveIndex', + 'remove_values' => 'setRemoveValues', + 'search' => 'setSearch', + 'select_aliases' => 'setSelectAliases', + 'select_all_aliases' => 'setSelectAllAliases', + 'select_edge_count' => 'setSelectEdgeCount', + 'select_indexes' => 'setSelectIndexes', + 'select_keys' => 'setSelectKeys', + 'select_key_count' => 'setSelectKeyCount', + 'select_node_count' => 'setSelectNodeCount', + 'select_values' => 'setSelectValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'insert_alias' => 'getInsertAlias', + 'insert_edges' => 'getInsertEdges', + 'insert_index' => 'getInsertIndex', + 'insert_nodes' => 'getInsertNodes', + 'insert_values' => 'getInsertValues', + 'remove' => 'getRemove', + 'remove_aliases' => 'getRemoveAliases', + 'remove_index' => 'getRemoveIndex', + 'remove_values' => 'getRemoveValues', + 'search' => 'getSearch', + 'select_aliases' => 'getSelectAliases', + 'select_all_aliases' => 'getSelectAllAliases', + 'select_edge_count' => 'getSelectEdgeCount', + 'select_indexes' => 'getSelectIndexes', + 'select_keys' => 'getSelectKeys', + 'select_key_count' => 'getSelectKeyCount', + 'select_node_count' => 'getSelectNodeCount', + 'select_values' => 'getSelectValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('insert_alias', $data ?? [], null); + $this->setIfExists('insert_edges', $data ?? [], null); + $this->setIfExists('insert_index', $data ?? [], null); + $this->setIfExists('insert_nodes', $data ?? [], null); + $this->setIfExists('insert_values', $data ?? [], null); + $this->setIfExists('remove', $data ?? [], null); + $this->setIfExists('remove_aliases', $data ?? [], null); + $this->setIfExists('remove_index', $data ?? [], null); + $this->setIfExists('remove_values', $data ?? [], null); + $this->setIfExists('search', $data ?? [], null); + $this->setIfExists('select_aliases', $data ?? [], null); + $this->setIfExists('select_all_aliases', $data ?? [], null); + $this->setIfExists('select_edge_count', $data ?? [], null); + $this->setIfExists('select_indexes', $data ?? [], null); + $this->setIfExists('select_keys', $data ?? [], null); + $this->setIfExists('select_key_count', $data ?? [], null); + $this->setIfExists('select_node_count', $data ?? [], null); + $this->setIfExists('select_values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['insert_alias'] === null) { + $invalidProperties[] = "'insert_alias' can't be null"; + } + if ($this->container['insert_edges'] === null) { + $invalidProperties[] = "'insert_edges' can't be null"; + } + if ($this->container['insert_index'] === null) { + $invalidProperties[] = "'insert_index' can't be null"; + } + if ($this->container['insert_nodes'] === null) { + $invalidProperties[] = "'insert_nodes' can't be null"; + } + if ($this->container['insert_values'] === null) { + $invalidProperties[] = "'insert_values' can't be null"; + } + if ($this->container['remove'] === null) { + $invalidProperties[] = "'remove' can't be null"; + } + if ($this->container['remove_aliases'] === null) { + $invalidProperties[] = "'remove_aliases' can't be null"; + } + if ($this->container['remove_index'] === null) { + $invalidProperties[] = "'remove_index' can't be null"; + } + if ($this->container['remove_values'] === null) { + $invalidProperties[] = "'remove_values' can't be null"; + } + if ($this->container['search'] === null) { + $invalidProperties[] = "'search' can't be null"; + } + if ($this->container['select_aliases'] === null) { + $invalidProperties[] = "'select_aliases' can't be null"; + } + if ($this->container['select_all_aliases'] === null) { + $invalidProperties[] = "'select_all_aliases' can't be null"; + } + if ($this->container['select_edge_count'] === null) { + $invalidProperties[] = "'select_edge_count' can't be null"; + } + if ($this->container['select_indexes'] === null) { + $invalidProperties[] = "'select_indexes' can't be null"; + } + if ($this->container['select_keys'] === null) { + $invalidProperties[] = "'select_keys' can't be null"; + } + if ($this->container['select_key_count'] === null) { + $invalidProperties[] = "'select_key_count' can't be null"; + } + if ($this->container['select_node_count'] === null) { + $invalidProperties[] = "'select_node_count' can't be null"; + } + if ($this->container['select_values'] === null) { + $invalidProperties[] = "'select_values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets insert_alias + * + * @return \Agnesoft\AgdbApi\Model\InsertAliasesQuery + */ + public function getInsertAlias() + { + return $this->container['insert_alias']; + } + + /** + * Sets insert_alias + * + * @param \Agnesoft\AgdbApi\Model\InsertAliasesQuery $insert_alias insert_alias + * + * @return self + */ + public function setInsertAlias($insert_alias) + { + if (is_null($insert_alias)) { + throw new \InvalidArgumentException('non-nullable insert_alias cannot be null'); + } + $this->container['insert_alias'] = $insert_alias; + + return $this; + } + + /** + * Gets insert_edges + * + * @return \Agnesoft\AgdbApi\Model\InsertEdgesQuery + */ + public function getInsertEdges() + { + return $this->container['insert_edges']; + } + + /** + * Sets insert_edges + * + * @param \Agnesoft\AgdbApi\Model\InsertEdgesQuery $insert_edges insert_edges + * + * @return self + */ + public function setInsertEdges($insert_edges) + { + if (is_null($insert_edges)) { + throw new \InvalidArgumentException('non-nullable insert_edges cannot be null'); + } + $this->container['insert_edges'] = $insert_edges; + + return $this; + } + + /** + * Gets insert_index + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getInsertIndex() + { + return $this->container['insert_index']; + } + + /** + * Sets insert_index + * + * @param \Agnesoft\AgdbApi\Model\DbValue $insert_index insert_index + * + * @return self + */ + public function setInsertIndex($insert_index) + { + if (is_null($insert_index)) { + throw new \InvalidArgumentException('non-nullable insert_index cannot be null'); + } + $this->container['insert_index'] = $insert_index; + + return $this; + } + + /** + * Gets insert_nodes + * + * @return \Agnesoft\AgdbApi\Model\InsertNodesQuery + */ + public function getInsertNodes() + { + return $this->container['insert_nodes']; + } + + /** + * Sets insert_nodes + * + * @param \Agnesoft\AgdbApi\Model\InsertNodesQuery $insert_nodes insert_nodes + * + * @return self + */ + public function setInsertNodes($insert_nodes) + { + if (is_null($insert_nodes)) { + throw new \InvalidArgumentException('non-nullable insert_nodes cannot be null'); + } + $this->container['insert_nodes'] = $insert_nodes; + + return $this; + } + + /** + * Gets insert_values + * + * @return \Agnesoft\AgdbApi\Model\InsertValuesQuery + */ + public function getInsertValues() + { + return $this->container['insert_values']; + } + + /** + * Sets insert_values + * + * @param \Agnesoft\AgdbApi\Model\InsertValuesQuery $insert_values insert_values + * + * @return self + */ + public function setInsertValues($insert_values) + { + if (is_null($insert_values)) { + throw new \InvalidArgumentException('non-nullable insert_values cannot be null'); + } + $this->container['insert_values'] = $insert_values; + + return $this; + } + + /** + * Gets remove + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getRemove() + { + return $this->container['remove']; + } + + /** + * Sets remove + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $remove remove + * + * @return self + */ + public function setRemove($remove) + { + if (is_null($remove)) { + throw new \InvalidArgumentException('non-nullable remove cannot be null'); + } + $this->container['remove'] = $remove; + + return $this; + } + + /** + * Gets remove_aliases + * + * @return string[] + */ + public function getRemoveAliases() + { + return $this->container['remove_aliases']; + } + + /** + * Sets remove_aliases + * + * @param string[] $remove_aliases Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. + * + * @return self + */ + public function setRemoveAliases($remove_aliases) + { + if (is_null($remove_aliases)) { + throw new \InvalidArgumentException('non-nullable remove_aliases cannot be null'); + } + $this->container['remove_aliases'] = $remove_aliases; + + return $this; + } + + /** + * Gets remove_index + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getRemoveIndex() + { + return $this->container['remove_index']; + } + + /** + * Sets remove_index + * + * @param \Agnesoft\AgdbApi\Model\DbValue $remove_index remove_index + * + * @return self + */ + public function setRemoveIndex($remove_index) + { + if (is_null($remove_index)) { + throw new \InvalidArgumentException('non-nullable remove_index cannot be null'); + } + $this->container['remove_index'] = $remove_index; + + return $this; + } + + /** + * Gets remove_values + * + * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery + */ + public function getRemoveValues() + { + return $this->container['remove_values']; + } + + /** + * Sets remove_values + * + * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $remove_values remove_values + * + * @return self + */ + public function setRemoveValues($remove_values) + { + if (is_null($remove_values)) { + throw new \InvalidArgumentException('non-nullable remove_values cannot be null'); + } + $this->container['remove_values'] = $remove_values; + + return $this; + } + + /** + * Gets search + * + * @return \Agnesoft\AgdbApi\Model\SearchQuery + */ + public function getSearch() + { + return $this->container['search']; + } + + /** + * Sets search + * + * @param \Agnesoft\AgdbApi\Model\SearchQuery $search search + * + * @return self + */ + public function setSearch($search) + { + if (is_null($search)) { + throw new \InvalidArgumentException('non-nullable search cannot be null'); + } + $this->container['search'] = $search; + + return $this; + } + + /** + * Gets select_aliases + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getSelectAliases() + { + return $this->container['select_aliases']; + } + + /** + * Sets select_aliases + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $select_aliases select_aliases + * + * @return self + */ + public function setSelectAliases($select_aliases) + { + if (is_null($select_aliases)) { + throw new \InvalidArgumentException('non-nullable select_aliases cannot be null'); + } + $this->container['select_aliases'] = $select_aliases; + + return $this; + } + + /** + * Gets select_all_aliases + * + * @return object + */ + public function getSelectAllAliases() + { + return $this->container['select_all_aliases']; + } + + /** + * Sets select_all_aliases + * + * @param object $select_all_aliases Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. + * + * @return self + */ + public function setSelectAllAliases($select_all_aliases) + { + if (is_null($select_all_aliases)) { + throw new \InvalidArgumentException('non-nullable select_all_aliases cannot be null'); + } + $this->container['select_all_aliases'] = $select_all_aliases; + + return $this; + } + + /** + * Gets select_edge_count + * + * @return \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery + */ + public function getSelectEdgeCount() + { + return $this->container['select_edge_count']; + } + + /** + * Sets select_edge_count + * + * @param \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery $select_edge_count select_edge_count + * + * @return self + */ + public function setSelectEdgeCount($select_edge_count) + { + if (is_null($select_edge_count)) { + throw new \InvalidArgumentException('non-nullable select_edge_count cannot be null'); + } + $this->container['select_edge_count'] = $select_edge_count; + + return $this; + } + + /** + * Gets select_indexes + * + * @return object + */ + public function getSelectIndexes() + { + return $this->container['select_indexes']; + } + + /** + * Sets select_indexes + * + * @param object $select_indexes Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. + * + * @return self + */ + public function setSelectIndexes($select_indexes) + { + if (is_null($select_indexes)) { + throw new \InvalidArgumentException('non-nullable select_indexes cannot be null'); + } + $this->container['select_indexes'] = $select_indexes; + + return $this; + } + + /** + * Gets select_keys + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getSelectKeys() + { + return $this->container['select_keys']; + } + + /** + * Sets select_keys + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $select_keys select_keys + * + * @return self + */ + public function setSelectKeys($select_keys) + { + if (is_null($select_keys)) { + throw new \InvalidArgumentException('non-nullable select_keys cannot be null'); + } + $this->container['select_keys'] = $select_keys; + + return $this; + } + + /** + * Gets select_key_count + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getSelectKeyCount() + { + return $this->container['select_key_count']; + } + + /** + * Sets select_key_count + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $select_key_count select_key_count + * + * @return self + */ + public function setSelectKeyCount($select_key_count) + { + if (is_null($select_key_count)) { + throw new \InvalidArgumentException('non-nullable select_key_count cannot be null'); + } + $this->container['select_key_count'] = $select_key_count; + + return $this; + } + + /** + * Gets select_node_count + * + * @return object + */ + public function getSelectNodeCount() + { + return $this->container['select_node_count']; + } + + /** + * Sets select_node_count + * + * @param object $select_node_count Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. + * + * @return self + */ + public function setSelectNodeCount($select_node_count) + { + if (is_null($select_node_count)) { + throw new \InvalidArgumentException('non-nullable select_node_count cannot be null'); + } + $this->container['select_node_count'] = $select_node_count; + + return $this; + } + + /** + * Gets select_values + * + * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery + */ + public function getSelectValues() + { + return $this->container['select_values']; + } + + /** + * Sets select_values + * + * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $select_values select_values + * + * @return self + */ + public function setSelectValues($select_values) + { + if (is_null($select_values)) { + throw new \InvalidArgumentException('non-nullable select_values cannot be null'); + } + $this->container['select_values'] = $select_values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf.php b/agdb_api/php/lib/Model/QueryTypeOneOf.php new file mode 100644 index 00000000..1c5260c8 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'insert_alias' => '\Agnesoft\AgdbApi\Model\InsertAliasesQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'insert_alias' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'insert_alias' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'insert_alias' => 'InsertAlias' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'insert_alias' => 'setInsertAlias' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'insert_alias' => 'getInsertAlias' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('insert_alias', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['insert_alias'] === null) { + $invalidProperties[] = "'insert_alias' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets insert_alias + * + * @return \Agnesoft\AgdbApi\Model\InsertAliasesQuery + */ + public function getInsertAlias() + { + return $this->container['insert_alias']; + } + + /** + * Sets insert_alias + * + * @param \Agnesoft\AgdbApi\Model\InsertAliasesQuery $insert_alias insert_alias + * + * @return self + */ + public function setInsertAlias($insert_alias) + { + if (is_null($insert_alias)) { + throw new \InvalidArgumentException('non-nullable insert_alias cannot be null'); + } + $this->container['insert_alias'] = $insert_alias; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf1.php b/agdb_api/php/lib/Model/QueryTypeOneOf1.php new file mode 100644 index 00000000..f5a71097 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf1.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'insert_edges' => '\Agnesoft\AgdbApi\Model\InsertEdgesQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'insert_edges' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'insert_edges' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'insert_edges' => 'InsertEdges' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'insert_edges' => 'setInsertEdges' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'insert_edges' => 'getInsertEdges' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('insert_edges', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['insert_edges'] === null) { + $invalidProperties[] = "'insert_edges' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets insert_edges + * + * @return \Agnesoft\AgdbApi\Model\InsertEdgesQuery + */ + public function getInsertEdges() + { + return $this->container['insert_edges']; + } + + /** + * Sets insert_edges + * + * @param \Agnesoft\AgdbApi\Model\InsertEdgesQuery $insert_edges insert_edges + * + * @return self + */ + public function setInsertEdges($insert_edges) + { + if (is_null($insert_edges)) { + throw new \InvalidArgumentException('non-nullable insert_edges cannot be null'); + } + $this->container['insert_edges'] = $insert_edges; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf10.php b/agdb_api/php/lib/Model/QueryTypeOneOf10.php new file mode 100644 index 00000000..d5086535 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf10.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf10 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_10'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_all_aliases' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_all_aliases' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_all_aliases' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_all_aliases' => 'SelectAllAliases' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_all_aliases' => 'setSelectAllAliases' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_all_aliases' => 'getSelectAllAliases' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_all_aliases', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_all_aliases'] === null) { + $invalidProperties[] = "'select_all_aliases' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_all_aliases + * + * @return object + */ + public function getSelectAllAliases() + { + return $this->container['select_all_aliases']; + } + + /** + * Sets select_all_aliases + * + * @param object $select_all_aliases Query to select all aliases in the database. The result will be number of returned aliases and list of elements with a single property `String(\"alias\")` holding the value `String`. + * + * @return self + */ + public function setSelectAllAliases($select_all_aliases) + { + if (is_null($select_all_aliases)) { + throw new \InvalidArgumentException('non-nullable select_all_aliases cannot be null'); + } + $this->container['select_all_aliases'] = $select_all_aliases; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf11.php b/agdb_api/php/lib/Model/QueryTypeOneOf11.php new file mode 100644 index 00000000..a603a1f7 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf11.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf11 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_11'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_edge_count' => '\Agnesoft\AgdbApi\Model\SelectEdgeCountQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_edge_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_edge_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_edge_count' => 'SelectEdgeCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_edge_count' => 'setSelectEdgeCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_edge_count' => 'getSelectEdgeCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_edge_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_edge_count'] === null) { + $invalidProperties[] = "'select_edge_count' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_edge_count + * + * @return \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery + */ + public function getSelectEdgeCount() + { + return $this->container['select_edge_count']; + } + + /** + * Sets select_edge_count + * + * @param \Agnesoft\AgdbApi\Model\SelectEdgeCountQuery $select_edge_count select_edge_count + * + * @return self + */ + public function setSelectEdgeCount($select_edge_count) + { + if (is_null($select_edge_count)) { + throw new \InvalidArgumentException('non-nullable select_edge_count cannot be null'); + } + $this->container['select_edge_count'] = $select_edge_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf12.php b/agdb_api/php/lib/Model/QueryTypeOneOf12.php new file mode 100644 index 00000000..9a45244b --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf12.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf12 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_12'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_indexes' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_indexes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_indexes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_indexes' => 'SelectIndexes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_indexes' => 'setSelectIndexes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_indexes' => 'getSelectIndexes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_indexes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_indexes'] === null) { + $invalidProperties[] = "'select_indexes' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_indexes + * + * @return object + */ + public function getSelectIndexes() + { + return $this->container['select_indexes']; + } + + /** + * Sets select_indexes + * + * @param object $select_indexes Query to select all indexes in the database. The result will be number of returned indexes and single element with index 0 and the properties corresponding to the names of the indexes (keys) with `u64` values representing number of indexed values in each index. + * + * @return self + */ + public function setSelectIndexes($select_indexes) + { + if (is_null($select_indexes)) { + throw new \InvalidArgumentException('non-nullable select_indexes cannot be null'); + } + $this->container['select_indexes'] = $select_indexes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf13.php b/agdb_api/php/lib/Model/QueryTypeOneOf13.php new file mode 100644 index 00000000..bcb1a946 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf13.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf13 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_13'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_keys' => '\Agnesoft\AgdbApi\Model\QueryIds' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_keys' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_keys' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_keys' => 'SelectKeys' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_keys' => 'setSelectKeys' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_keys' => 'getSelectKeys' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_keys', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_keys'] === null) { + $invalidProperties[] = "'select_keys' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_keys + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getSelectKeys() + { + return $this->container['select_keys']; + } + + /** + * Sets select_keys + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $select_keys select_keys + * + * @return self + */ + public function setSelectKeys($select_keys) + { + if (is_null($select_keys)) { + throw new \InvalidArgumentException('non-nullable select_keys cannot be null'); + } + $this->container['select_keys'] = $select_keys; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf14.php b/agdb_api/php/lib/Model/QueryTypeOneOf14.php new file mode 100644 index 00000000..25d986bf --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf14.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf14 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_14'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_key_count' => '\Agnesoft\AgdbApi\Model\QueryIds' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_key_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_key_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_key_count' => 'SelectKeyCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_key_count' => 'setSelectKeyCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_key_count' => 'getSelectKeyCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_key_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_key_count'] === null) { + $invalidProperties[] = "'select_key_count' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_key_count + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getSelectKeyCount() + { + return $this->container['select_key_count']; + } + + /** + * Sets select_key_count + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $select_key_count select_key_count + * + * @return self + */ + public function setSelectKeyCount($select_key_count) + { + if (is_null($select_key_count)) { + throw new \InvalidArgumentException('non-nullable select_key_count cannot be null'); + } + $this->container['select_key_count'] = $select_key_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf15.php b/agdb_api/php/lib/Model/QueryTypeOneOf15.php new file mode 100644 index 00000000..56877cce --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf15.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf15 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_15'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_node_count' => 'object' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_node_count' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_node_count' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_node_count' => 'SelectNodeCount' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_node_count' => 'setSelectNodeCount' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_node_count' => 'getSelectNodeCount' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_node_count', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_node_count'] === null) { + $invalidProperties[] = "'select_node_count' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_node_count + * + * @return object + */ + public function getSelectNodeCount() + { + return $this->container['select_node_count']; + } + + /** + * Sets select_node_count + * + * @param object $select_node_count Query to select number of nodes in the database. The result will be 1 and elements with a single element of id 0 and a single property `String(\"node_count\")` with a value `u64` represneting number of nodes in teh database. + * + * @return self + */ + public function setSelectNodeCount($select_node_count) + { + if (is_null($select_node_count)) { + throw new \InvalidArgumentException('non-nullable select_node_count cannot be null'); + } + $this->container['select_node_count'] = $select_node_count; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf16.php b/agdb_api/php/lib/Model/QueryTypeOneOf16.php new file mode 100644 index 00000000..d4866bb2 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf16.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf16 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_16'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_values' => 'SelectValues' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_values' => 'setSelectValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_values' => 'getSelectValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_values'] === null) { + $invalidProperties[] = "'select_values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_values + * + * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery + */ + public function getSelectValues() + { + return $this->container['select_values']; + } + + /** + * Sets select_values + * + * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $select_values select_values + * + * @return self + */ + public function setSelectValues($select_values) + { + if (is_null($select_values)) { + throw new \InvalidArgumentException('non-nullable select_values cannot be null'); + } + $this->container['select_values'] = $select_values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf2.php b/agdb_api/php/lib/Model/QueryTypeOneOf2.php new file mode 100644 index 00000000..0e33cae2 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf2.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf2 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_2'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'insert_index' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'insert_index' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'insert_index' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'insert_index' => 'InsertIndex' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'insert_index' => 'setInsertIndex' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'insert_index' => 'getInsertIndex' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('insert_index', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['insert_index'] === null) { + $invalidProperties[] = "'insert_index' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets insert_index + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getInsertIndex() + { + return $this->container['insert_index']; + } + + /** + * Sets insert_index + * + * @param \Agnesoft\AgdbApi\Model\DbValue $insert_index insert_index + * + * @return self + */ + public function setInsertIndex($insert_index) + { + if (is_null($insert_index)) { + throw new \InvalidArgumentException('non-nullable insert_index cannot be null'); + } + $this->container['insert_index'] = $insert_index; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf3.php b/agdb_api/php/lib/Model/QueryTypeOneOf3.php new file mode 100644 index 00000000..1a9a5a49 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf3.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf3 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_3'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'insert_nodes' => '\Agnesoft\AgdbApi\Model\InsertNodesQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'insert_nodes' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'insert_nodes' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'insert_nodes' => 'InsertNodes' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'insert_nodes' => 'setInsertNodes' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'insert_nodes' => 'getInsertNodes' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('insert_nodes', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['insert_nodes'] === null) { + $invalidProperties[] = "'insert_nodes' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets insert_nodes + * + * @return \Agnesoft\AgdbApi\Model\InsertNodesQuery + */ + public function getInsertNodes() + { + return $this->container['insert_nodes']; + } + + /** + * Sets insert_nodes + * + * @param \Agnesoft\AgdbApi\Model\InsertNodesQuery $insert_nodes insert_nodes + * + * @return self + */ + public function setInsertNodes($insert_nodes) + { + if (is_null($insert_nodes)) { + throw new \InvalidArgumentException('non-nullable insert_nodes cannot be null'); + } + $this->container['insert_nodes'] = $insert_nodes; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf4.php b/agdb_api/php/lib/Model/QueryTypeOneOf4.php new file mode 100644 index 00000000..9769eba2 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf4.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf4 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_4'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'insert_values' => '\Agnesoft\AgdbApi\Model\InsertValuesQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'insert_values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'insert_values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'insert_values' => 'InsertValues' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'insert_values' => 'setInsertValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'insert_values' => 'getInsertValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('insert_values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['insert_values'] === null) { + $invalidProperties[] = "'insert_values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets insert_values + * + * @return \Agnesoft\AgdbApi\Model\InsertValuesQuery + */ + public function getInsertValues() + { + return $this->container['insert_values']; + } + + /** + * Sets insert_values + * + * @param \Agnesoft\AgdbApi\Model\InsertValuesQuery $insert_values insert_values + * + * @return self + */ + public function setInsertValues($insert_values) + { + if (is_null($insert_values)) { + throw new \InvalidArgumentException('non-nullable insert_values cannot be null'); + } + $this->container['insert_values'] = $insert_values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf5.php b/agdb_api/php/lib/Model/QueryTypeOneOf5.php new file mode 100644 index 00000000..95efe46b --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf5.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf5 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_5'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'remove' => '\Agnesoft\AgdbApi\Model\QueryIds' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'remove' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'remove' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'remove' => 'Remove' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'remove' => 'setRemove' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'remove' => 'getRemove' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('remove', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['remove'] === null) { + $invalidProperties[] = "'remove' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets remove + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getRemove() + { + return $this->container['remove']; + } + + /** + * Sets remove + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $remove remove + * + * @return self + */ + public function setRemove($remove) + { + if (is_null($remove)) { + throw new \InvalidArgumentException('non-nullable remove cannot be null'); + } + $this->container['remove'] = $remove; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf6.php b/agdb_api/php/lib/Model/QueryTypeOneOf6.php new file mode 100644 index 00000000..b42c2a0c --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf6.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf6 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_6'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'remove_aliases' => 'string[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'remove_aliases' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'remove_aliases' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'remove_aliases' => 'RemoveAliases' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'remove_aliases' => 'setRemoveAliases' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'remove_aliases' => 'getRemoveAliases' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('remove_aliases', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['remove_aliases'] === null) { + $invalidProperties[] = "'remove_aliases' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets remove_aliases + * + * @return string[] + */ + public function getRemoveAliases() + { + return $this->container['remove_aliases']; + } + + /** + * Sets remove_aliases + * + * @param string[] $remove_aliases Query to remove aliases from the database. It is not an error if an alias to be removed already does not exist. The result will be a negative number signifying how many aliases have been actually removed. + * + * @return self + */ + public function setRemoveAliases($remove_aliases) + { + if (is_null($remove_aliases)) { + throw new \InvalidArgumentException('non-nullable remove_aliases cannot be null'); + } + $this->container['remove_aliases'] = $remove_aliases; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf7.php b/agdb_api/php/lib/Model/QueryTypeOneOf7.php new file mode 100644 index 00000000..b949af79 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf7.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf7 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_7'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'remove_index' => '\Agnesoft\AgdbApi\Model\DbValue' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'remove_index' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'remove_index' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'remove_index' => 'RemoveIndex' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'remove_index' => 'setRemoveIndex' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'remove_index' => 'getRemoveIndex' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('remove_index', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['remove_index'] === null) { + $invalidProperties[] = "'remove_index' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets remove_index + * + * @return \Agnesoft\AgdbApi\Model\DbValue + */ + public function getRemoveIndex() + { + return $this->container['remove_index']; + } + + /** + * Sets remove_index + * + * @param \Agnesoft\AgdbApi\Model\DbValue $remove_index remove_index + * + * @return self + */ + public function setRemoveIndex($remove_index) + { + if (is_null($remove_index)) { + throw new \InvalidArgumentException('non-nullable remove_index cannot be null'); + } + $this->container['remove_index'] = $remove_index; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf8.php b/agdb_api/php/lib/Model/QueryTypeOneOf8.php new file mode 100644 index 00000000..24ef1dd9 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf8.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf8 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_8'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'remove_values' => '\Agnesoft\AgdbApi\Model\SelectValuesQuery' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'remove_values' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'remove_values' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'remove_values' => 'RemoveValues' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'remove_values' => 'setRemoveValues' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'remove_values' => 'getRemoveValues' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('remove_values', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['remove_values'] === null) { + $invalidProperties[] = "'remove_values' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets remove_values + * + * @return \Agnesoft\AgdbApi\Model\SelectValuesQuery + */ + public function getRemoveValues() + { + return $this->container['remove_values']; + } + + /** + * Sets remove_values + * + * @param \Agnesoft\AgdbApi\Model\SelectValuesQuery $remove_values remove_values + * + * @return self + */ + public function setRemoveValues($remove_values) + { + if (is_null($remove_values)) { + throw new \InvalidArgumentException('non-nullable remove_values cannot be null'); + } + $this->container['remove_values'] = $remove_values; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryTypeOneOf9.php b/agdb_api/php/lib/Model/QueryTypeOneOf9.php new file mode 100644 index 00000000..305fd318 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryTypeOneOf9.php @@ -0,0 +1,412 @@ + + */ +class QueryTypeOneOf9 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryType_oneOf_9'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'select_aliases' => '\Agnesoft\AgdbApi\Model\QueryIds' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'select_aliases' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'select_aliases' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'select_aliases' => 'SelectAliases' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'select_aliases' => 'setSelectAliases' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'select_aliases' => 'getSelectAliases' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('select_aliases', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['select_aliases'] === null) { + $invalidProperties[] = "'select_aliases' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets select_aliases + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getSelectAliases() + { + return $this->container['select_aliases']; + } + + /** + * Sets select_aliases + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $select_aliases select_aliases + * + * @return self + */ + public function setSelectAliases($select_aliases) + { + if (is_null($select_aliases)) { + throw new \InvalidArgumentException('non-nullable select_aliases cannot be null'); + } + $this->container['select_aliases'] = $select_aliases; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryValues.php b/agdb_api/php/lib/Model/QueryValues.php new file mode 100644 index 00000000..361a349b --- /dev/null +++ b/agdb_api/php/lib/Model/QueryValues.php @@ -0,0 +1,450 @@ + + */ +class QueryValues implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryValues'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'single' => '\Agnesoft\AgdbApi\Model\DbKeyValue[]', + 'multi' => '\Agnesoft\AgdbApi\Model\DbKeyValue[][]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'single' => null, + 'multi' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'single' => false, + 'multi' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'single' => 'Single', + 'multi' => 'Multi' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'single' => 'setSingle', + 'multi' => 'setMulti' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'single' => 'getSingle', + 'multi' => 'getMulti' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('single', $data ?? [], null); + $this->setIfExists('multi', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['single'] === null) { + $invalidProperties[] = "'single' can't be null"; + } + if ($this->container['multi'] === null) { + $invalidProperties[] = "'multi' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets single + * + * @return \Agnesoft\AgdbApi\Model\DbKeyValue[] + */ + public function getSingle() + { + return $this->container['single']; + } + + /** + * Sets single + * + * @param \Agnesoft\AgdbApi\Model\DbKeyValue[] $single Single list of properties (key-value pairs) to be applied to all elements in a query. + * + * @return self + */ + public function setSingle($single) + { + if (is_null($single)) { + throw new \InvalidArgumentException('non-nullable single cannot be null'); + } + $this->container['single'] = $single; + + return $this; + } + + /** + * Gets multi + * + * @return \Agnesoft\AgdbApi\Model\DbKeyValue[][] + */ + public function getMulti() + { + return $this->container['multi']; + } + + /** + * Sets multi + * + * @param \Agnesoft\AgdbApi\Model\DbKeyValue[][] $multi List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. + * + * @return self + */ + public function setMulti($multi) + { + if (is_null($multi)) { + throw new \InvalidArgumentException('non-nullable multi cannot be null'); + } + $this->container['multi'] = $multi; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryValuesOneOf.php b/agdb_api/php/lib/Model/QueryValuesOneOf.php new file mode 100644 index 00000000..481f23e5 --- /dev/null +++ b/agdb_api/php/lib/Model/QueryValuesOneOf.php @@ -0,0 +1,412 @@ + + */ +class QueryValuesOneOf implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryValues_oneOf'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'single' => '\Agnesoft\AgdbApi\Model\DbKeyValue[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'single' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'single' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'single' => 'Single' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'single' => 'setSingle' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'single' => 'getSingle' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('single', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['single'] === null) { + $invalidProperties[] = "'single' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets single + * + * @return \Agnesoft\AgdbApi\Model\DbKeyValue[] + */ + public function getSingle() + { + return $this->container['single']; + } + + /** + * Sets single + * + * @param \Agnesoft\AgdbApi\Model\DbKeyValue[] $single Single list of properties (key-value pairs) to be applied to all elements in a query. + * + * @return self + */ + public function setSingle($single) + { + if (is_null($single)) { + throw new \InvalidArgumentException('non-nullable single cannot be null'); + } + $this->container['single'] = $single; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/QueryValuesOneOf1.php b/agdb_api/php/lib/Model/QueryValuesOneOf1.php new file mode 100644 index 00000000..40e5878b --- /dev/null +++ b/agdb_api/php/lib/Model/QueryValuesOneOf1.php @@ -0,0 +1,412 @@ + + */ +class QueryValuesOneOf1 implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'QueryValues_oneOf_1'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'multi' => '\Agnesoft\AgdbApi\Model\DbKeyValue[][]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'multi' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'multi' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'multi' => 'Multi' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'multi' => 'setMulti' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'multi' => 'getMulti' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('multi', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['multi'] === null) { + $invalidProperties[] = "'multi' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets multi + * + * @return \Agnesoft\AgdbApi\Model\DbKeyValue[][] + */ + public function getMulti() + { + return $this->container['multi']; + } + + /** + * Sets multi + * + * @param \Agnesoft\AgdbApi\Model\DbKeyValue[][] $multi List of lists of properties (key-value pairs) to be applied to all elements in a query. There must be as many lists of properties as ids in a query. + * + * @return self + */ + public function setMulti($multi) + { + if (is_null($multi)) { + throw new \InvalidArgumentException('non-nullable multi cannot be null'); + } + $this->container['multi'] = $multi; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/SearchQuery.php b/agdb_api/php/lib/Model/SearchQuery.php new file mode 100644 index 00000000..a054fd25 --- /dev/null +++ b/agdb_api/php/lib/Model/SearchQuery.php @@ -0,0 +1,653 @@ + + */ +class SearchQuery implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SearchQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'algorithm' => '\Agnesoft\AgdbApi\Model\SearchQueryAlgorithm', + 'conditions' => '\Agnesoft\AgdbApi\Model\QueryCondition[]', + 'destination' => '\Agnesoft\AgdbApi\Model\QueryId', + 'limit' => 'int', + 'offset' => 'int', + 'order_by' => '\Agnesoft\AgdbApi\Model\DbKeyOrder[]', + 'origin' => '\Agnesoft\AgdbApi\Model\QueryId' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'algorithm' => null, + 'conditions' => null, + 'destination' => null, + 'limit' => 'int64', + 'offset' => 'int64', + 'order_by' => null, + 'origin' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'algorithm' => false, + 'conditions' => false, + 'destination' => false, + 'limit' => false, + 'offset' => false, + 'order_by' => false, + 'origin' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'algorithm' => 'algorithm', + 'conditions' => 'conditions', + 'destination' => 'destination', + 'limit' => 'limit', + 'offset' => 'offset', + 'order_by' => 'order_by', + 'origin' => 'origin' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'algorithm' => 'setAlgorithm', + 'conditions' => 'setConditions', + 'destination' => 'setDestination', + 'limit' => 'setLimit', + 'offset' => 'setOffset', + 'order_by' => 'setOrderBy', + 'origin' => 'setOrigin' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'algorithm' => 'getAlgorithm', + 'conditions' => 'getConditions', + 'destination' => 'getDestination', + 'limit' => 'getLimit', + 'offset' => 'getOffset', + 'order_by' => 'getOrderBy', + 'origin' => 'getOrigin' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('algorithm', $data ?? [], null); + $this->setIfExists('conditions', $data ?? [], null); + $this->setIfExists('destination', $data ?? [], null); + $this->setIfExists('limit', $data ?? [], null); + $this->setIfExists('offset', $data ?? [], null); + $this->setIfExists('order_by', $data ?? [], null); + $this->setIfExists('origin', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['algorithm'] === null) { + $invalidProperties[] = "'algorithm' can't be null"; + } + if ($this->container['conditions'] === null) { + $invalidProperties[] = "'conditions' can't be null"; + } + if ($this->container['destination'] === null) { + $invalidProperties[] = "'destination' can't be null"; + } + if ($this->container['limit'] === null) { + $invalidProperties[] = "'limit' can't be null"; + } + if (($this->container['limit'] < 0)) { + $invalidProperties[] = "invalid value for 'limit', must be bigger than or equal to 0."; + } + + if ($this->container['offset'] === null) { + $invalidProperties[] = "'offset' can't be null"; + } + if (($this->container['offset'] < 0)) { + $invalidProperties[] = "invalid value for 'offset', must be bigger than or equal to 0."; + } + + if ($this->container['order_by'] === null) { + $invalidProperties[] = "'order_by' can't be null"; + } + if ($this->container['origin'] === null) { + $invalidProperties[] = "'origin' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets algorithm + * + * @return \Agnesoft\AgdbApi\Model\SearchQueryAlgorithm + */ + public function getAlgorithm() + { + return $this->container['algorithm']; + } + + /** + * Sets algorithm + * + * @param \Agnesoft\AgdbApi\Model\SearchQueryAlgorithm $algorithm algorithm + * + * @return self + */ + public function setAlgorithm($algorithm) + { + if (is_null($algorithm)) { + throw new \InvalidArgumentException('non-nullable algorithm cannot be null'); + } + $this->container['algorithm'] = $algorithm; + + return $this; + } + + /** + * Gets conditions + * + * @return \Agnesoft\AgdbApi\Model\QueryCondition[] + */ + public function getConditions() + { + return $this->container['conditions']; + } + + /** + * Sets conditions + * + * @param \Agnesoft\AgdbApi\Model\QueryCondition[] $conditions Set of conditions every element must satisfy to be included in the result. Some conditions also influence the search path as well. + * + * @return self + */ + public function setConditions($conditions) + { + if (is_null($conditions)) { + throw new \InvalidArgumentException('non-nullable conditions cannot be null'); + } + $this->container['conditions'] = $conditions; + + return $this; + } + + /** + * Gets destination + * + * @return \Agnesoft\AgdbApi\Model\QueryId + */ + public function getDestination() + { + return $this->container['destination']; + } + + /** + * Sets destination + * + * @param \Agnesoft\AgdbApi\Model\QueryId $destination destination + * + * @return self + */ + public function setDestination($destination) + { + if (is_null($destination)) { + throw new \InvalidArgumentException('non-nullable destination cannot be null'); + } + $this->container['destination'] = $destination; + + return $this; + } + + /** + * Gets limit + * + * @return int + */ + public function getLimit() + { + return $this->container['limit']; + } + + /** + * Sets limit + * + * @param int $limit How many elements maximum to return. + * + * @return self + */ + public function setLimit($limit) + { + if (is_null($limit)) { + throw new \InvalidArgumentException('non-nullable limit cannot be null'); + } + + if (($limit < 0)) { + throw new \InvalidArgumentException('invalid value for $limit when calling SearchQuery., must be bigger than or equal to 0.'); + } + + $this->container['limit'] = $limit; + + return $this; + } + + /** + * Gets offset + * + * @return int + */ + public function getOffset() + { + return $this->container['offset']; + } + + /** + * Sets offset + * + * @param int $offset How many elements that would be returned should be skipped in the result. + * + * @return self + */ + public function setOffset($offset) + { + if (is_null($offset)) { + throw new \InvalidArgumentException('non-nullable offset cannot be null'); + } + + if (($offset < 0)) { + throw new \InvalidArgumentException('invalid value for $offset when calling SearchQuery., must be bigger than or equal to 0.'); + } + + $this->container['offset'] = $offset; + + return $this; + } + + /** + * Gets order_by + * + * @return \Agnesoft\AgdbApi\Model\DbKeyOrder[] + */ + public function getOrderBy() + { + return $this->container['order_by']; + } + + /** + * Sets order_by + * + * @param \Agnesoft\AgdbApi\Model\DbKeyOrder[] $order_by Order of the elements in the result. The sorting happens before `offset` and `limit` are applied. + * + * @return self + */ + public function setOrderBy($order_by) + { + if (is_null($order_by)) { + throw new \InvalidArgumentException('non-nullable order_by cannot be null'); + } + $this->container['order_by'] = $order_by; + + return $this; + } + + /** + * Gets origin + * + * @return \Agnesoft\AgdbApi\Model\QueryId + */ + public function getOrigin() + { + return $this->container['origin']; + } + + /** + * Sets origin + * + * @param \Agnesoft\AgdbApi\Model\QueryId $origin origin + * + * @return self + */ + public function setOrigin($origin) + { + if (is_null($origin)) { + throw new \InvalidArgumentException('non-nullable origin cannot be null'); + } + $this->container['origin'] = $origin; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/SearchQueryAlgorithm.php b/agdb_api/php/lib/Model/SearchQueryAlgorithm.php new file mode 100644 index 00000000..86b558e9 --- /dev/null +++ b/agdb_api/php/lib/Model/SearchQueryAlgorithm.php @@ -0,0 +1,69 @@ + + */ +class SelectEdgeCountQuery implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SelectEdgeCountQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'from' => 'bool', + 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'to' => 'bool' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'from' => null, + 'ids' => null, + 'to' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'from' => false, + 'ids' => false, + 'to' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'from' => 'from', + 'ids' => 'ids', + 'to' => 'to' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'from' => 'setFrom', + 'ids' => 'setIds', + 'to' => 'setTo' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'from' => 'getFrom', + 'ids' => 'getIds', + 'to' => 'getTo' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('from', $data ?? [], null); + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('to', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['from'] === null) { + $invalidProperties[] = "'from' can't be null"; + } + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + if ($this->container['to'] === null) { + $invalidProperties[] = "'to' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets from + * + * @return bool + */ + public function getFrom() + { + return $this->container['from']; + } + + /** + * Sets from + * + * @param bool $from If set to `true` the query will count outgoing edges from the nodes. + * + * @return self + */ + public function setFrom($from) + { + if (is_null($from)) { + throw new \InvalidArgumentException('non-nullable from cannot be null'); + } + $this->container['from'] = $from; + + return $this; + } + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets to + * + * @return bool + */ + public function getTo() + { + return $this->container['to']; + } + + /** + * Sets to + * + * @param bool $to If set to `true` the query will count incoming edges to the nodes. + * + * @return self + */ + public function setTo($to) + { + if (is_null($to)) { + throw new \InvalidArgumentException('non-nullable to cannot be null'); + } + $this->container['to'] = $to; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/SelectValuesQuery.php b/agdb_api/php/lib/Model/SelectValuesQuery.php new file mode 100644 index 00000000..9f41b4a4 --- /dev/null +++ b/agdb_api/php/lib/Model/SelectValuesQuery.php @@ -0,0 +1,450 @@ + + */ +class SelectValuesQuery implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'SelectValuesQuery'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'ids' => '\Agnesoft\AgdbApi\Model\QueryIds', + 'keys' => '\Agnesoft\AgdbApi\Model\DbValue[]' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'ids' => null, + 'keys' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'ids' => false, + 'keys' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'ids' => 'ids', + 'keys' => 'keys' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'ids' => 'setIds', + 'keys' => 'setKeys' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'ids' => 'getIds', + 'keys' => 'getKeys' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('ids', $data ?? [], null); + $this->setIfExists('keys', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['ids'] === null) { + $invalidProperties[] = "'ids' can't be null"; + } + if ($this->container['keys'] === null) { + $invalidProperties[] = "'keys' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets ids + * + * @return \Agnesoft\AgdbApi\Model\QueryIds + */ + public function getIds() + { + return $this->container['ids']; + } + + /** + * Sets ids + * + * @param \Agnesoft\AgdbApi\Model\QueryIds $ids ids + * + * @return self + */ + public function setIds($ids) + { + if (is_null($ids)) { + throw new \InvalidArgumentException('non-nullable ids cannot be null'); + } + $this->container['ids'] = $ids; + + return $this; + } + + /** + * Gets keys + * + * @return \Agnesoft\AgdbApi\Model\DbValue[] + */ + public function getKeys() + { + return $this->container['keys']; + } + + /** + * Sets keys + * + * @param \Agnesoft\AgdbApi\Model\DbValue[] $keys keys + * + * @return self + */ + public function setKeys($keys) + { + if (is_null($keys)) { + throw new \InvalidArgumentException('non-nullable keys cannot be null'); + } + $this->container['keys'] = $keys; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ServerDatabase.php b/agdb_api/php/lib/Model/ServerDatabase.php new file mode 100644 index 00000000..7a67582d --- /dev/null +++ b/agdb_api/php/lib/Model/ServerDatabase.php @@ -0,0 +1,578 @@ + + */ +class ServerDatabase implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerDatabase'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'backup' => 'int', + 'db_type' => '\Agnesoft\AgdbApi\Model\DbType', + 'name' => 'string', + 'role' => '\Agnesoft\AgdbApi\Model\DbUserRole', + 'size' => 'int' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'backup' => 'int64', + 'db_type' => null, + 'name' => null, + 'role' => null, + 'size' => 'int64' + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'backup' => false, + 'db_type' => false, + 'name' => false, + 'role' => false, + 'size' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'backup' => 'backup', + 'db_type' => 'db_type', + 'name' => 'name', + 'role' => 'role', + 'size' => 'size' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'backup' => 'setBackup', + 'db_type' => 'setDbType', + 'name' => 'setName', + 'role' => 'setRole', + 'size' => 'setSize' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'backup' => 'getBackup', + 'db_type' => 'getDbType', + 'name' => 'getName', + 'role' => 'getRole', + 'size' => 'getSize' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('backup', $data ?? [], null); + $this->setIfExists('db_type', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + $this->setIfExists('role', $data ?? [], null); + $this->setIfExists('size', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['backup'] === null) { + $invalidProperties[] = "'backup' can't be null"; + } + if (($this->container['backup'] < 0)) { + $invalidProperties[] = "invalid value for 'backup', must be bigger than or equal to 0."; + } + + if ($this->container['db_type'] === null) { + $invalidProperties[] = "'db_type' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + if ($this->container['role'] === null) { + $invalidProperties[] = "'role' can't be null"; + } + if ($this->container['size'] === null) { + $invalidProperties[] = "'size' can't be null"; + } + if (($this->container['size'] < 0)) { + $invalidProperties[] = "invalid value for 'size', must be bigger than or equal to 0."; + } + + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets backup + * + * @return int + */ + public function getBackup() + { + return $this->container['backup']; + } + + /** + * Sets backup + * + * @param int $backup backup + * + * @return self + */ + public function setBackup($backup) + { + if (is_null($backup)) { + throw new \InvalidArgumentException('non-nullable backup cannot be null'); + } + + if (($backup < 0)) { + throw new \InvalidArgumentException('invalid value for $backup when calling ServerDatabase., must be bigger than or equal to 0.'); + } + + $this->container['backup'] = $backup; + + return $this; + } + + /** + * Gets db_type + * + * @return \Agnesoft\AgdbApi\Model\DbType + */ + public function getDbType() + { + return $this->container['db_type']; + } + + /** + * Sets db_type + * + * @param \Agnesoft\AgdbApi\Model\DbType $db_type db_type + * + * @return self + */ + public function setDbType($db_type) + { + if (is_null($db_type)) { + throw new \InvalidArgumentException('non-nullable db_type cannot be null'); + } + $this->container['db_type'] = $db_type; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + + /** + * Gets role + * + * @return \Agnesoft\AgdbApi\Model\DbUserRole + */ + public function getRole() + { + return $this->container['role']; + } + + /** + * Sets role + * + * @param \Agnesoft\AgdbApi\Model\DbUserRole $role role + * + * @return self + */ + public function setRole($role) + { + if (is_null($role)) { + throw new \InvalidArgumentException('non-nullable role cannot be null'); + } + $this->container['role'] = $role; + + return $this; + } + + /** + * Gets size + * + * @return int + */ + public function getSize() + { + return $this->container['size']; + } + + /** + * Sets size + * + * @param int $size size + * + * @return self + */ + public function setSize($size) + { + if (is_null($size)) { + throw new \InvalidArgumentException('non-nullable size cannot be null'); + } + + if (($size < 0)) { + throw new \InvalidArgumentException('invalid value for $size when calling ServerDatabase., must be bigger than or equal to 0.'); + } + + $this->container['size'] = $size; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ServerDatabaseRename.php b/agdb_api/php/lib/Model/ServerDatabaseRename.php new file mode 100644 index 00000000..33340354 --- /dev/null +++ b/agdb_api/php/lib/Model/ServerDatabaseRename.php @@ -0,0 +1,412 @@ + + */ +class ServerDatabaseRename implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerDatabaseRename'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'new_name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'new_name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'new_name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'new_name' => 'new_name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'new_name' => 'setNewName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'new_name' => 'getNewName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('new_name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['new_name'] === null) { + $invalidProperties[] = "'new_name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets new_name + * + * @return string + */ + public function getNewName() + { + return $this->container['new_name']; + } + + /** + * Sets new_name + * + * @param string $new_name new_name + * + * @return self + */ + public function setNewName($new_name) + { + if (is_null($new_name)) { + throw new \InvalidArgumentException('non-nullable new_name cannot be null'); + } + $this->container['new_name'] = $new_name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/ServerDatabaseResource.php b/agdb_api/php/lib/Model/ServerDatabaseResource.php new file mode 100644 index 00000000..87915f77 --- /dev/null +++ b/agdb_api/php/lib/Model/ServerDatabaseResource.php @@ -0,0 +1,412 @@ + + */ +class ServerDatabaseResource implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'ServerDatabaseResource'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'resource' => '\Agnesoft\AgdbApi\Model\DbResource' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'resource' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'resource' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'resource' => 'resource' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'resource' => 'setResource' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'resource' => 'getResource' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('resource', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['resource'] === null) { + $invalidProperties[] = "'resource' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets resource + * + * @return \Agnesoft\AgdbApi\Model\DbResource + */ + public function getResource() + { + return $this->container['resource']; + } + + /** + * Sets resource + * + * @param \Agnesoft\AgdbApi\Model\DbResource $resource resource + * + * @return self + */ + public function setResource($resource) + { + if (is_null($resource)) { + throw new \InvalidArgumentException('non-nullable resource cannot be null'); + } + $this->container['resource'] = $resource; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/UserCredentials.php b/agdb_api/php/lib/Model/UserCredentials.php new file mode 100644 index 00000000..55dfc668 --- /dev/null +++ b/agdb_api/php/lib/Model/UserCredentials.php @@ -0,0 +1,412 @@ + + */ +class UserCredentials implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UserCredentials'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'password' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'password' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'password' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'password' => 'password' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'password' => 'setPassword' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'password' => 'getPassword' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('password', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/UserLogin.php b/agdb_api/php/lib/Model/UserLogin.php new file mode 100644 index 00000000..bd301d08 --- /dev/null +++ b/agdb_api/php/lib/Model/UserLogin.php @@ -0,0 +1,449 @@ + + */ +class UserLogin implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UserLogin'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'password' => 'string', + 'username' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'password' => null, + 'username' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'password' => false, + 'username' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'password' => 'password', + 'username' => 'username' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'password' => 'setPassword', + 'username' => 'setUsername' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'password' => 'getPassword', + 'username' => 'getUsername' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('password', $data ?? [], null); + $this->setIfExists('username', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['password'] === null) { + $invalidProperties[] = "'password' can't be null"; + } + if ($this->container['username'] === null) { + $invalidProperties[] = "'username' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets password + * + * @return string + */ + public function getPassword() + { + return $this->container['password']; + } + + /** + * Sets password + * + * @param string $password password + * + * @return self + */ + public function setPassword($password) + { + if (is_null($password)) { + throw new \InvalidArgumentException('non-nullable password cannot be null'); + } + $this->container['password'] = $password; + + return $this; + } + + /** + * Gets username + * + * @return string + */ + public function getUsername() + { + return $this->container['username']; + } + + /** + * Sets username + * + * @param string $username username + * + * @return self + */ + public function setUsername($username) + { + if (is_null($username)) { + throw new \InvalidArgumentException('non-nullable username cannot be null'); + } + $this->container['username'] = $username; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/Model/UserStatus.php b/agdb_api/php/lib/Model/UserStatus.php new file mode 100644 index 00000000..b07d2f55 --- /dev/null +++ b/agdb_api/php/lib/Model/UserStatus.php @@ -0,0 +1,486 @@ + + */ +class UserStatus implements ModelInterface, ArrayAccess, \JsonSerializable +{ + public const DISCRIMINATOR = null; + + /** + * The original name of the model. + * + * @var string + */ + protected static $openAPIModelName = 'UserStatus'; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @var string[] + */ + protected static $openAPITypes = [ + 'admin' => 'bool', + 'login' => 'bool', + 'name' => 'string' + ]; + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @var string[] + * @phpstan-var array + * @psalm-var array + */ + protected static $openAPIFormats = [ + 'admin' => null, + 'login' => null, + 'name' => null + ]; + + /** + * Array of nullable properties. Used for (de)serialization + * + * @var boolean[] + */ + protected static array $openAPINullables = [ + 'admin' => false, + 'login' => false, + 'name' => false + ]; + + /** + * If a nullable field gets set to null, insert it here + * + * @var boolean[] + */ + protected array $openAPINullablesSetToNull = []; + + /** + * Array of property to type mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPITypes() + { + return self::$openAPITypes; + } + + /** + * Array of property to format mappings. Used for (de)serialization + * + * @return array + */ + public static function openAPIFormats() + { + return self::$openAPIFormats; + } + + /** + * Array of nullable properties + * + * @return array + */ + protected static function openAPINullables(): array + { + return self::$openAPINullables; + } + + /** + * Array of nullable field names deliberately set to null + * + * @return boolean[] + */ + private function getOpenAPINullablesSetToNull(): array + { + return $this->openAPINullablesSetToNull; + } + + /** + * Setter - Array of nullable field names deliberately set to null + * + * @param boolean[] $openAPINullablesSetToNull + */ + private function setOpenAPINullablesSetToNull(array $openAPINullablesSetToNull): void + { + $this->openAPINullablesSetToNull = $openAPINullablesSetToNull; + } + + /** + * Checks if a property is nullable + * + * @param string $property + * @return bool + */ + public static function isNullable(string $property): bool + { + return self::openAPINullables()[$property] ?? false; + } + + /** + * Checks if a nullable property is set to null. + * + * @param string $property + * @return bool + */ + public function isNullableSetToNull(string $property): bool + { + return in_array($property, $this->getOpenAPINullablesSetToNull(), true); + } + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @var string[] + */ + protected static $attributeMap = [ + 'admin' => 'admin', + 'login' => 'login', + 'name' => 'name' + ]; + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @var string[] + */ + protected static $setters = [ + 'admin' => 'setAdmin', + 'login' => 'setLogin', + 'name' => 'setName' + ]; + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @var string[] + */ + protected static $getters = [ + 'admin' => 'getAdmin', + 'login' => 'getLogin', + 'name' => 'getName' + ]; + + /** + * Array of attributes where the key is the local name, + * and the value is the original name + * + * @return array + */ + public static function attributeMap() + { + return self::$attributeMap; + } + + /** + * Array of attributes to setter functions (for deserialization of responses) + * + * @return array + */ + public static function setters() + { + return self::$setters; + } + + /** + * Array of attributes to getter functions (for serialization of requests) + * + * @return array + */ + public static function getters() + { + return self::$getters; + } + + /** + * The original name of the model. + * + * @return string + */ + public function getModelName() + { + return self::$openAPIModelName; + } + + + /** + * Associative array for storing property values + * + * @var mixed[] + */ + protected $container = []; + + /** + * Constructor + * + * @param mixed[] $data Associated array of property values + * initializing the model + */ + public function __construct(array $data = null) + { + $this->setIfExists('admin', $data ?? [], null); + $this->setIfExists('login', $data ?? [], null); + $this->setIfExists('name', $data ?? [], null); + } + + /** + * Sets $this->container[$variableName] to the given data or to the given default Value; if $variableName + * is nullable and its value is set to null in the $fields array, then mark it as "set to null" in the + * $this->openAPINullablesSetToNull array + * + * @param string $variableName + * @param array $fields + * @param mixed $defaultValue + */ + private function setIfExists(string $variableName, array $fields, $defaultValue): void + { + if (self::isNullable($variableName) && array_key_exists($variableName, $fields) && is_null($fields[$variableName])) { + $this->openAPINullablesSetToNull[] = $variableName; + } + + $this->container[$variableName] = $fields[$variableName] ?? $defaultValue; + } + + /** + * Show all the invalid properties with reasons. + * + * @return array invalid properties with reasons + */ + public function listInvalidProperties() + { + $invalidProperties = []; + + if ($this->container['admin'] === null) { + $invalidProperties[] = "'admin' can't be null"; + } + if ($this->container['login'] === null) { + $invalidProperties[] = "'login' can't be null"; + } + if ($this->container['name'] === null) { + $invalidProperties[] = "'name' can't be null"; + } + return $invalidProperties; + } + + /** + * Validate all the properties in the model + * return true if all passed + * + * @return bool True if all properties are valid + */ + public function valid() + { + return count($this->listInvalidProperties()) === 0; + } + + + /** + * Gets admin + * + * @return bool + */ + public function getAdmin() + { + return $this->container['admin']; + } + + /** + * Sets admin + * + * @param bool $admin admin + * + * @return self + */ + public function setAdmin($admin) + { + if (is_null($admin)) { + throw new \InvalidArgumentException('non-nullable admin cannot be null'); + } + $this->container['admin'] = $admin; + + return $this; + } + + /** + * Gets login + * + * @return bool + */ + public function getLogin() + { + return $this->container['login']; + } + + /** + * Sets login + * + * @param bool $login login + * + * @return self + */ + public function setLogin($login) + { + if (is_null($login)) { + throw new \InvalidArgumentException('non-nullable login cannot be null'); + } + $this->container['login'] = $login; + + return $this; + } + + /** + * Gets name + * + * @return string + */ + public function getName() + { + return $this->container['name']; + } + + /** + * Sets name + * + * @param string $name name + * + * @return self + */ + public function setName($name) + { + if (is_null($name)) { + throw new \InvalidArgumentException('non-nullable name cannot be null'); + } + $this->container['name'] = $name; + + return $this; + } + /** + * Returns true if offset exists. False otherwise. + * + * @param integer $offset Offset + * + * @return boolean + */ + public function offsetExists($offset): bool + { + return isset($this->container[$offset]); + } + + /** + * Gets offset. + * + * @param integer $offset Offset + * + * @return mixed|null + */ + #[\ReturnTypeWillChange] + public function offsetGet($offset) + { + return $this->container[$offset] ?? null; + } + + /** + * Sets value based on offset. + * + * @param int|null $offset Offset + * @param mixed $value Value to be set + * + * @return void + */ + public function offsetSet($offset, $value): void + { + if (is_null($offset)) { + $this->container[] = $value; + } else { + $this->container[$offset] = $value; + } + } + + /** + * Unsets offset. + * + * @param integer $offset Offset + * + * @return void + */ + public function offsetUnset($offset): void + { + unset($this->container[$offset]); + } + + /** + * Serializes the object to a value that can be serialized natively by json_encode(). + * @link https://www.php.net/manual/en/jsonserializable.jsonserialize.php + * + * @return mixed Returns data which can be serialized by json_encode(), which is a value + * of any type other than a resource. + */ + #[\ReturnTypeWillChange] + public function jsonSerialize() + { + return ObjectSerializer::sanitizeForSerialization($this); + } + + /** + * Gets the string presentation of the object + * + * @return string + */ + public function __toString() + { + return json_encode( + ObjectSerializer::sanitizeForSerialization($this), + JSON_PRETTY_PRINT + ); + } + + /** + * Gets a header-safe presentation of the object + * + * @return string + */ + public function toHeaderValue() + { + return json_encode(ObjectSerializer::sanitizeForSerialization($this)); + } +} + + diff --git a/agdb_api/php/lib/ObjectSerializer.php b/agdb_api/php/lib/ObjectSerializer.php new file mode 100644 index 00000000..ef532a57 --- /dev/null +++ b/agdb_api/php/lib/ObjectSerializer.php @@ -0,0 +1,617 @@ +format('Y-m-d') : $data->format(self::$dateTimeFormat); + } + + if (is_array($data)) { + foreach ($data as $property => $value) { + $data[$property] = self::sanitizeForSerialization($value); + } + return $data; + } + + if (is_object($data)) { + $values = []; + if ($data instanceof ModelInterface) { + $formats = $data::openAPIFormats(); + foreach ($data::openAPITypes() as $property => $openAPIType) { + $getter = $data::getters()[$property]; + $value = $data->$getter(); + if ($value !== null && !in_array($openAPIType, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + $callable = [$openAPIType, 'getAllowableEnumValues']; + if (is_callable($callable)) { + /** array $callable */ + $allowedEnumTypes = $callable(); + if (!in_array($value, $allowedEnumTypes, true)) { + $imploded = implode("', '", $allowedEnumTypes); + throw new \InvalidArgumentException("Invalid value for enum '$openAPIType', must be one of: '$imploded'"); + } + } + } + if (($data::isNullable($property) && $data->isNullableSetToNull($property)) || $value !== null) { + $values[$data::attributeMap()[$property]] = self::sanitizeForSerialization($value, $openAPIType, $formats[$property]); + } + } + } else { + foreach($data as $property => $value) { + $values[$property] = self::sanitizeForSerialization($value); + } + } + return (object)$values; + } else { + return (string)$data; + } + } + + /** + * Sanitize filename by removing path. + * e.g. ../../sun.gif becomes sun.gif + * + * @param string $filename filename to be sanitized + * + * @return string the sanitized filename + */ + public static function sanitizeFilename($filename) + { + if (preg_match("/.*[\/\\\\](.*)$/", $filename, $match)) { + return $match[1]; + } else { + return $filename; + } + } + + /** + * Shorter timestamp microseconds to 6 digits length. + * + * @param string $timestamp Original timestamp + * + * @return string the shorten timestamp + */ + public static function sanitizeTimestamp($timestamp) + { + if (!is_string($timestamp)) return $timestamp; + + return preg_replace('/(:\d{2}.\d{6})\d*/', '$1', $timestamp); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the path, by url-encoding. + * + * @param string $value a string which will be part of the path + * + * @return string the serialized object + */ + public static function toPathValue($value) + { + return rawurlencode(self::toString($value)); + } + + /** + * Checks if a value is empty, based on its OpenAPI type. + * + * @param mixed $value + * @param string $openApiType + * + * @return bool true if $value is empty + */ + private static function isEmptyValue($value, string $openApiType): bool + { + # If empty() returns false, it is not empty regardless of its type. + if (!empty($value)) { + return false; + } + + # Null is always empty, as we cannot send a real "null" value in a query parameter. + if ($value === null) { + return true; + } + + switch ($openApiType) { + # For numeric values, false and '' are considered empty. + # This comparison is safe for floating point values, since the previous call to empty() will + # filter out values that don't match 0. + case 'int': + case 'integer': + return $value !== 0; + + case 'number': + case 'float': + return $value !== 0 && $value !== 0.0; + + # For boolean values, '' is considered empty + case 'bool': + case 'boolean': + return !in_array($value, [false, 0], true); + + # For string values, '' is considered empty. + case 'string': + return $value === ''; + + # For all the other types, any value at this point can be considered empty. + default: + return true; + } + } + + /** + * Take query parameter properties and turn it into an array suitable for + * native http_build_query or GuzzleHttp\Psr7\Query::build. + * + * @param mixed $value Parameter value + * @param string $paramName Parameter name + * @param string $openApiType OpenAPIType eg. array or object + * @param string $style Parameter serialization style + * @param bool $explode Parameter explode option + * @param bool $required Whether query param is required or not + * + * @return array + */ + public static function toQueryValue( + $value, + string $paramName, + string $openApiType = 'string', + string $style = 'form', + bool $explode = true, + bool $required = true + ): array { + + # Check if we should omit this parameter from the query. This should only happen when: + # - Parameter is NOT required; AND + # - its value is set to a value that is equivalent to "empty", depending on its OpenAPI type. For + # example, 0 as "int" or "boolean" is NOT an empty value. + if (self::isEmptyValue($value, $openApiType)) { + if ($required) { + return ["{$paramName}" => '']; + } else { + return []; + } + } + + # Handle DateTime objects in query + if($openApiType === "\\DateTime" && $value instanceof \DateTime) { + return ["{$paramName}" => $value->format(self::$dateTimeFormat)]; + } + + $query = []; + $value = (in_array($openApiType, ['object', 'array'], true)) ? (array)$value : $value; + + // since \GuzzleHttp\Psr7\Query::build fails with nested arrays + // need to flatten array first + $flattenArray = function ($arr, $name, &$result = []) use (&$flattenArray, $style, $explode) { + if (!is_array($arr)) return $arr; + + foreach ($arr as $k => $v) { + $prop = ($style === 'deepObject') ? $prop = "{$name}[{$k}]" : $k; + + if (is_array($v)) { + $flattenArray($v, $prop, $result); + } else { + if ($style !== 'deepObject' && !$explode) { + // push key itself + $result[] = $prop; + } + $result[$prop] = $v; + } + } + return $result; + }; + + $value = $flattenArray($value, $paramName); + + // https://github.com/OAI/OpenAPI-Specification/blob/main/versions/3.1.0.md#style-values + if ($openApiType === 'array' && $style === 'deepObject' && $explode) { + return $value; + } + + if ($openApiType === 'object' && ($style === 'deepObject' || $explode)) { + return $value; + } + + if ('boolean' === $openApiType && is_bool($value)) { + $value = self::convertBoolToQueryStringFormat($value); + } + + // handle style in serializeCollection + $query[$paramName] = ($explode) ? $value : self::serializeCollection((array)$value, $style); + + return $query; + } + + /** + * Convert boolean value to format for query string. + * + * @param bool $value Boolean value + * + * @return int|string Boolean value in format + */ + public static function convertBoolToQueryStringFormat(bool $value) + { + if (Configuration::BOOLEAN_FORMAT_STRING == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString()) { + return $value ? 'true' : 'false'; + } + + return (int) $value; + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the header. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string $value a string which will be part of the header + * + * @return string the header string + */ + public static function toHeaderValue($value) + { + $callable = [$value, 'toHeaderValue']; + if (is_callable($callable)) { + return $callable(); + } + + return self::toString($value); + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the http body (form parameter). If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * + * @param string|\SplFileObject $value the value of the form parameter + * + * @return string the form string + */ + public static function toFormValue($value) + { + if ($value instanceof \SplFileObject) { + return $value->getRealPath(); + } else { + return self::toString($value); + } + } + + /** + * Take value and turn it into a string suitable for inclusion in + * the parameter. If it's a string, pass through unchanged + * If it's a datetime object, format it in ISO8601 + * If it's a boolean, convert it to "true" or "false". + * + * @param float|int|bool|\DateTime $value the value of the parameter + * + * @return string the header string + */ + public static function toString($value) + { + if ($value instanceof \DateTime) { // datetime in ISO8601 format + return $value->format(self::$dateTimeFormat); + } elseif (is_bool($value)) { + return $value ? 'true' : 'false'; + } else { + return (string) $value; + } + } + + /** + * Serialize an array to a string. + * + * @param array $collection collection to serialize to a string + * @param string $style the format use for serialization (csv, + * ssv, tsv, pipes, multi) + * @param bool $allowCollectionFormatMulti allow collection format to be a multidimensional array + * + * @return string + */ + public static function serializeCollection(array $collection, $style, $allowCollectionFormatMulti = false) + { + if ($allowCollectionFormatMulti && ('multi' === $style)) { + // http_build_query() almost does the job for us. We just + // need to fix the result of multidimensional arrays. + return preg_replace('/%5B[0-9]+%5D=/', '=', http_build_query($collection, '', '&')); + } + switch ($style) { + case 'pipeDelimited': + case 'pipes': + return implode('|', $collection); + + case 'tsv': + return implode("\t", $collection); + + case 'spaceDelimited': + case 'ssv': + return implode(' ', $collection); + + case 'simple': + case 'csv': + // Deliberate fall through. CSV is default format. + default: + return implode(',', $collection); + } + } + + /** + * Deserialize a JSON string into an object + * + * @param mixed $data object or primitive to be deserialized + * @param string $class class name is passed as a string + * @param string[] $httpHeaders HTTP headers + * + * @return object|array|null a single or an array of $class instances + */ + public static function deserialize($data, $class, $httpHeaders = null) + { + if (null === $data) { + return null; + } + + if (strcasecmp(substr($class, -2), '[]') === 0) { + $data = is_string($data) ? json_decode($data) : $data; + + if (!is_array($data)) { + throw new \InvalidArgumentException("Invalid array '$class'"); + } + + $subClass = substr($class, 0, -2); + $values = []; + foreach ($data as $key => $value) { + $values[] = self::deserialize($value, $subClass, null); + } + return $values; + } + + if (preg_match('/^(array<|map\[)/', $class)) { // for associative array e.g. array + $data = is_string($data) ? json_decode($data) : $data; + settype($data, 'array'); + $inner = substr($class, 4, -1); + $deserialized = []; + if (strrpos($inner, ",") !== false) { + $subClass_array = explode(',', $inner, 2); + $subClass = $subClass_array[1]; + foreach ($data as $key => $value) { + $deserialized[$key] = self::deserialize($value, $subClass, null); + } + } + return $deserialized; + } + + if ($class === 'object') { + settype($data, 'array'); + return $data; + } elseif ($class === 'mixed') { + settype($data, gettype($data)); + return $data; + } + + if ($class === '\DateTime') { + // Some APIs return an invalid, empty string as a + // date-time property. DateTime::__construct() will return + // the current time for empty input which is probably not + // what is meant. The invalid empty string is probably to + // be interpreted as a missing field/value. Let's handle + // this graceful. + if (!empty($data)) { + try { + return new \DateTime($data); + } catch (\Exception $exception) { + // Some APIs return a date-time with too high nanosecond + // precision for php's DateTime to handle. + // With provided regexp 6 digits of microseconds saved + return new \DateTime(self::sanitizeTimestamp($data)); + } + } else { + return null; + } + } + + if ($class === '\SplFileObject') { + $data = Utils::streamFor($data); + + /** @var \Psr\Http\Message\StreamInterface $data */ + + // determine file name + if ( + is_array($httpHeaders) + && array_key_exists('Content-Disposition', $httpHeaders) + && preg_match('/inline; filename=[\'"]?([^\'"\s]+)[\'"]?$/i', $httpHeaders['Content-Disposition'], $match) + ) { + $filename = Configuration::getDefaultConfiguration()->getTempFolderPath() . DIRECTORY_SEPARATOR . self::sanitizeFilename($match[1]); + } else { + $filename = tempnam(Configuration::getDefaultConfiguration()->getTempFolderPath(), ''); + } + + $file = fopen($filename, 'w'); + while ($chunk = $data->read(200)) { + fwrite($file, $chunk); + } + fclose($file); + + return new \SplFileObject($filename, 'r'); + } + + /** @psalm-suppress ParadoxicalCondition */ + if (in_array($class, ['\DateTime', '\SplFileObject', 'array', 'bool', 'boolean', 'byte', 'float', 'int', 'integer', 'mixed', 'number', 'object', 'string', 'void'], true)) { + settype($data, $class); + return $data; + } + + + if (method_exists($class, 'getAllowableEnumValues')) { + if (!in_array($data, $class::getAllowableEnumValues(), true)) { + $imploded = implode("', '", $class::getAllowableEnumValues()); + throw new \InvalidArgumentException("Invalid value for enum '$class', must be one of: '$imploded'"); + } + return $data; + } else { + $data = is_string($data) ? json_decode($data) : $data; + + if (is_array($data)) { + $data = (object)$data; + } + + // If a discriminator is defined and points to a valid subclass, use it. + $discriminator = $class::DISCRIMINATOR; + if (!empty($discriminator) && isset($data->{$discriminator}) && is_string($data->{$discriminator})) { + $subclass = '\Agnesoft\AgdbApi\Model\\' . $data->{$discriminator}; + if (is_subclass_of($subclass, $class)) { + $class = $subclass; + } + } + + /** @var ModelInterface $instance */ + $instance = new $class(); + foreach ($instance::openAPITypes() as $property => $type) { + $propertySetter = $instance::setters()[$property]; + + if (!isset($propertySetter)) { + continue; + } + + if (!isset($data->{$instance::attributeMap()[$property]})) { + if ($instance::isNullable($property)) { + $instance->$propertySetter(null); + } + + continue; + } + + if (isset($data->{$instance::attributeMap()[$property]})) { + $propertyValue = $data->{$instance::attributeMap()[$property]}; + $instance->$propertySetter(self::deserialize($propertyValue, $type, null)); + } + } + return $instance; + } + } + + /** + * Build a query string from an array of key value pairs. + * + * This function can use the return value of `parse()` to build a query + * string. This function does not modify the provided keys when an array is + * encountered (like `http_build_query()` would). + * + * The function is copied from https://github.com/guzzle/psr7/blob/a243f80a1ca7fe8ceed4deee17f12c1930efe662/src/Query.php#L59-L112 + * with a modification which is described in https://github.com/guzzle/psr7/pull/603 + * + * @param array $params Query string parameters. + * @param int|false $encoding Set to false to not encode, PHP_QUERY_RFC3986 + * to encode using RFC3986, or PHP_QUERY_RFC1738 + * to encode using RFC1738. + */ + public static function buildQuery(array $params, $encoding = PHP_QUERY_RFC3986): string + { + if (!$params) { + return ''; + } + + if ($encoding === false) { + $encoder = function (string $str): string { + return $str; + }; + } elseif ($encoding === PHP_QUERY_RFC3986) { + $encoder = 'rawurlencode'; + } elseif ($encoding === PHP_QUERY_RFC1738) { + $encoder = 'urlencode'; + } else { + throw new \InvalidArgumentException('Invalid type'); + } + + $castBool = Configuration::BOOLEAN_FORMAT_INT == Configuration::getDefaultConfiguration()->getBooleanFormatForQueryString() + ? function ($v) { return (int) $v; } + : function ($v) { return $v ? 'true' : 'false'; }; + + $qs = ''; + foreach ($params as $k => $v) { + $k = $encoder((string) $k); + if (!is_array($v)) { + $qs .= $k; + $v = is_bool($v) ? $castBool($v) : $v; + if ($v !== null) { + $qs .= '='.$encoder((string) $v); + } + $qs .= '&'; + } else { + foreach ($v as $vv) { + $qs .= $k; + $vv = is_bool($vv) ? $castBool($vv) : $vv; + if ($vv !== null) { + $qs .= '='.$encoder((string) $vv); + } + $qs .= '&'; + } + } + } + + return $qs ? (string) substr($qs, 0, -1) : ''; + } +} diff --git a/agdb_api/typescript/src/openapi.d.ts b/agdb_api/typescript/src/openapi.d.ts index a5a636ac..748613fd 100644 --- a/agdb_api/typescript/src/openapi.d.ts +++ b/agdb_api/typescript/src/openapi.d.ts @@ -1256,6 +1256,27 @@ declare namespace Paths { } } } + namespace AdminDbClear { + namespace Parameters { + export type Db = string; + export type Owner = string; + export type Resource = Components.Schemas.DbResource; + } + export interface PathParameters { + owner: Parameters.Owner; + db: Parameters.Db; + } + export interface QueryParameters { + resource: Parameters.Resource; + } + namespace Responses { + export type $201 = Components.Schemas.ServerDatabase; + export interface $401 { + } + export interface $404 { + } + } + } namespace AdminDbConvert { namespace Parameters { export type Db = string; @@ -2004,13 +2025,13 @@ export interface OperationMethods { config?: AxiosRequestConfig ): OperationResponse /** - * db_clear + * admin_db_clear */ - 'db_clear'( - parameters?: Parameters | null, + 'admin_db_clear'( + parameters?: Parameters | null, data?: any, config?: AxiosRequestConfig - ): OperationResponse + ): OperationResponse /** * admin_db_convert */ @@ -2376,13 +2397,13 @@ export interface PathsDictionary { } ['/api/v1/admin/db/{owner}/{db}/clear']: { /** - * db_clear + * admin_db_clear */ 'post'( - parameters?: Parameters | null, + parameters?: Parameters | null, data?: any, config?: AxiosRequestConfig - ): OperationResponse + ): OperationResponse } ['/api/v1/admin/db/{owner}/{db}/convert']: { /** diff --git a/agdb_server/openapi.json b/agdb_server/openapi.json index 749fdde5..805c9bf3 100644 --- a/agdb_server/openapi.json +++ b/agdb_server/openapi.json @@ -201,7 +201,7 @@ "tags": [ "agdb" ], - "operationId": "db_clear", + "operationId": "admin_db_clear", "parameters": [ { "name": "owner", @@ -244,9 +244,6 @@ "401": { "description": "unauthorized" }, - "403": { - "description": "server admin only" - }, "404": { "description": "user / db not found" } diff --git a/agdb_server/src/routes/admin/db.rs b/agdb_server/src/routes/admin/db.rs index 8b54bb07..b833eeec 100644 --- a/agdb_server/src/routes/admin/db.rs +++ b/agdb_server/src/routes/admin/db.rs @@ -143,7 +143,7 @@ pub(crate) async fn backup( #[utoipa::path(post, path = "/api/v1/admin/db/{owner}/{db}/clear", - operation_id = "db_clear", + operation_id = "admin_db_clear", tag = "agdb", security(("Token" = [])), params( @@ -154,7 +154,6 @@ pub(crate) async fn backup( responses( (status = 201, description = "db resource(s) cleared", body = ServerDatabase), (status = 401, description = "unauthorized"), - (status = 403, description = "server admin only"), (status = 404, description = "user / db not found"), ) )]