Initial commit

Set up general project structure, [cargo.toml](Cargo.toml) and [license](LICENSE)
Added [changelog](CHANGELOG.md) and reference in the [readme](README.md)
Migrated source files from [omg](https://crates.io/crates/omg) crate
This commit is contained in:
Aadi Desai 2023-05-08 22:49:08 +01:00
commit 40ebdf777d
Signed by: supleed2
SSH key fingerprint: SHA256:CkbNRs0yVzXEiUp2zd0PSxsfRUMFF9bLlKXtE1xEbKM
18 changed files with 1127 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/target

31
CHANGELOG.md Normal file
View file

@ -0,0 +1,31 @@
# Changelog
All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [Unreleased]
### Added
### Changed
### Deprecated
### Removed
### Fixed
### Security
## 0.1.0 - 2023-05-08
### Added
- General project structure, [cargo.toml](Cargo.toml) and [license](LICENSE).
- Changelog file (this file) and reference in the [readme](README.md).
- Source files from [omg](https://crates.io/crates/omg) crate.
[unreleased]: https://github.com/supleed2/omg-api/compare/v0.1.0...HEAD
[0.1.0]: https://github.com/supleed2/omg-api/releases/tag/v0.1.0

320
Cargo.lock generated Normal file
View file

@ -0,0 +1,320 @@
# This file is automatically @generated by Cargo.
# It is not intended for manual editing.
version = 3
[[package]]
name = "anstream"
version = "0.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "0ca84f3628370c59db74ee214b3263d58f9aadd9b4fe7e711fd87dc452b7f163"
dependencies = [
"anstyle",
"anstyle-parse",
"anstyle-query",
"anstyle-wincon",
"colorchoice",
"is-terminal",
"utf8parse",
]
[[package]]
name = "anstyle"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "41ed9a86bf92ae6580e0a31281f65a1b1d867c0cc68d5346e2ae128dddfa6a7d"
[[package]]
name = "anstyle-parse"
version = "0.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e765fd216e48e067936442276d1d57399e37bce53c264d6fefbe298080cb57ee"
dependencies = [
"utf8parse",
]
[[package]]
name = "anstyle-query"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "5ca11d4be1bab0c8bc8734a9aa7bf4ee8316d462a08c6ac5052f888fef5b494b"
dependencies = [
"windows-sys",
]
[[package]]
name = "anstyle-wincon"
version = "1.0.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "180abfa45703aebe0093f79badacc01b8fd4ea2e35118747e5811127f926e188"
dependencies = [
"anstyle",
"windows-sys",
]
[[package]]
name = "bitflags"
version = "1.3.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a"
[[package]]
name = "cc"
version = "1.0.79"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "50d30906286121d95be3d479533b458f87493b30a4b5f79a607db8f5d11aa91f"
[[package]]
name = "clap"
version = "4.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "34d21f9bf1b425d2968943631ec91202fe5e837264063503708b83013f8fc938"
dependencies = [
"clap_builder",
"clap_derive",
"once_cell",
]
[[package]]
name = "clap_builder"
version = "4.2.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "914c8c79fb560f238ef6429439a30023c862f7a28e688c58f7203f12b29970bd"
dependencies = [
"anstream",
"anstyle",
"bitflags",
"clap_lex",
"strsim",
]
[[package]]
name = "clap_derive"
version = "4.2.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "3f9644cd56d6b87dbe899ef8b053e331c0637664e9e21a33dfcdc36093f5c5c4"
dependencies = [
"heck",
"proc-macro2",
"quote",
"syn",
]
[[package]]
name = "clap_lex"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8a2dd5a6fe8c6e3502f568a6353e5273bbb15193ad9a89e457b9970798efbea1"
[[package]]
name = "colorchoice"
version = "1.0.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acbf1af155f9b9ef647e42cdc158db4b64a1b61f743629225fde6f3e0be2a7c7"
[[package]]
name = "errno"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a"
dependencies = [
"errno-dragonfly",
"libc",
"windows-sys",
]
[[package]]
name = "errno-dragonfly"
version = "0.1.2"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf"
dependencies = [
"cc",
"libc",
]
[[package]]
name = "heck"
version = "0.4.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8"
[[package]]
name = "hermit-abi"
version = "0.3.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "fed44880c466736ef9a5c5b5facefb5ed0785676d0c02d612db14e54f0d84286"
[[package]]
name = "io-lifetimes"
version = "1.0.10"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "9c66c74d2ae7e79a5a8f7ac924adbe38ee42a859c6539ad869eb51f0b52dc220"
dependencies = [
"hermit-abi",
"libc",
"windows-sys",
]
[[package]]
name = "is-terminal"
version = "0.4.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "adcf93614601c8129ddf72e2d5633df827ba6551541c6d8c59520a371475be1f"
dependencies = [
"hermit-abi",
"io-lifetimes",
"rustix",
"windows-sys",
]
[[package]]
name = "libc"
version = "0.2.144"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b00cc1c228a6782d0f076e7b232802e0c5689d41bb5df366f2a6b6621cfdfe1"
[[package]]
name = "linux-raw-sys"
version = "0.3.7"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ece97ea872ece730aed82664c424eb4c8291e1ff2480247ccf7409044bc6479f"
[[package]]
name = "omg-api"
version = "0.1.0"
dependencies = [
"clap",
]
[[package]]
name = "once_cell"
version = "1.17.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3"
[[package]]
name = "proc-macro2"
version = "1.0.56"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435"
dependencies = [
"unicode-ident",
]
[[package]]
name = "quote"
version = "1.0.27"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "8f4f29d145265ec1c483c7c654450edde0bfe043d3938d6972630663356d9500"
dependencies = [
"proc-macro2",
]
[[package]]
name = "rustix"
version = "0.37.19"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "acf8729d8542766f1b2cf77eb034d52f40d375bb8b615d0b147089946e16613d"
dependencies = [
"bitflags",
"errno",
"io-lifetimes",
"libc",
"linux-raw-sys",
"windows-sys",
]
[[package]]
name = "strsim"
version = "0.10.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623"
[[package]]
name = "syn"
version = "2.0.15"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "a34fcf3e8b60f57e6a14301a2e916d323af98b0ea63c599441eec8558660c822"
dependencies = [
"proc-macro2",
"quote",
"unicode-ident",
]
[[package]]
name = "unicode-ident"
version = "1.0.8"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4"
[[package]]
name = "utf8parse"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a"
[[package]]
name = "windows-sys"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9"
dependencies = [
"windows-targets",
]
[[package]]
name = "windows-targets"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5"
dependencies = [
"windows_aarch64_gnullvm",
"windows_aarch64_msvc",
"windows_i686_gnu",
"windows_i686_msvc",
"windows_x86_64_gnu",
"windows_x86_64_gnullvm",
"windows_x86_64_msvc",
]
[[package]]
name = "windows_aarch64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "91ae572e1b79dba883e0d315474df7305d12f569b400fcf90581b06062f7e1bc"
[[package]]
name = "windows_aarch64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "b2ef27e0d7bdfcfc7b868b317c1d32c641a6fe4629c171b8928c7b08d98d7cf3"
[[package]]
name = "windows_i686_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "622a1962a7db830d6fd0a69683c80a18fda201879f0f447f065a3b7467daa241"
[[package]]
name = "windows_i686_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "4542c6e364ce21bf45d69fdd2a8e455fa38d316158cfd43b3ac1c5b1b19f8e00"
[[package]]
name = "windows_x86_64_gnu"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "ca2b8a661f7628cbd23440e50b05d705db3686f894fc9580820623656af974b1"
[[package]]
name = "windows_x86_64_gnullvm"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "7896dbc1f41e08872e9d5e8f8baa8fdd2677f29468c4e156210174edc7f7b953"
[[package]]
name = "windows_x86_64_msvc"
version = "0.48.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a"

11
Cargo.toml Normal file
View file

@ -0,0 +1,11 @@
[package]
name = "omg-api"
version = "0.1.0"
edition = "2021"
description = "Library for interacting with the omg.lol API, used by the omg crate"
license = "Apache-2.0"
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
[dependencies]
clap = { version = "4.2.7", features = ["derive"] }

201
LICENSE Normal file
View file

@ -0,0 +1,201 @@
Apache License
Version 2.0, January 2004
http://www.apache.org/licenses/
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
1. Definitions.
"License" shall mean the terms and conditions for use, reproduction,
and distribution as defined by Sections 1 through 9 of this document.
"Licensor" shall mean the copyright owner or entity authorized by
the copyright owner that is granting the License.
"Legal Entity" shall mean the union of the acting entity and all
other entities that control, are controlled by, or are under common
control with that entity. For the purposes of this definition,
"control" means (i) the power, direct or indirect, to cause the
direction or management of such entity, whether by contract or
otherwise, or (ii) ownership of fifty percent (50%) or more of the
outstanding shares, or (iii) beneficial ownership of such entity.
"You" (or "Your") shall mean an individual or Legal Entity
exercising permissions granted by this License.
"Source" form shall mean the preferred form for making modifications,
including but not limited to software source code, documentation
source, and configuration files.
"Object" form shall mean any form resulting from mechanical
transformation or translation of a Source form, including but
not limited to compiled object code, generated documentation,
and conversions to other media types.
"Work" shall mean the work of authorship, whether in Source or
Object form, made available under the License, as indicated by a
copyright notice that is included in or attached to the work
(an example is provided in the Appendix below).
"Derivative Works" shall mean any work, whether in Source or Object
form, that is based on (or derived from) the Work and for which the
editorial revisions, annotations, elaborations, or other modifications
represent, as a whole, an original work of authorship. For the purposes
of this License, Derivative Works shall not include works that remain
separable from, or merely link (or bind by name) to the interfaces of,
the Work and Derivative Works thereof.
"Contribution" shall mean any work of authorship, including
the original version of the Work and any modifications or additions
to that Work or Derivative Works thereof, that is intentionally
submitted to Licensor for inclusion in the Work by the copyright owner
or by an individual or Legal Entity authorized to submit on behalf of
the copyright owner. For the purposes of this definition, "submitted"
means any form of electronic, verbal, or written communication sent
to the Licensor or its representatives, including but not limited to
communication on electronic mailing lists, source code control systems,
and issue tracking systems that are managed by, or on behalf of, the
Licensor for the purpose of discussing and improving the Work, but
excluding communication that is conspicuously marked or otherwise
designated in writing by the copyright owner as "Not a Contribution."
"Contributor" shall mean Licensor and any individual or Legal Entity
on behalf of whom a Contribution has been received by Licensor and
subsequently incorporated within the Work.
2. Grant of Copyright License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
copyright license to reproduce, prepare Derivative Works of,
publicly display, publicly perform, sublicense, and distribute the
Work and such Derivative Works in Source or Object form.
3. Grant of Patent License. Subject to the terms and conditions of
this License, each Contributor hereby grants to You a perpetual,
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
(except as stated in this section) patent license to make, have made,
use, offer to sell, sell, import, and otherwise transfer the Work,
where such license applies only to those patent claims licensable
by such Contributor that are necessarily infringed by their
Contribution(s) alone or by combination of their Contribution(s)
with the Work to which such Contribution(s) was submitted. If You
institute patent litigation against any entity (including a
cross-claim or counterclaim in a lawsuit) alleging that the Work
or a Contribution incorporated within the Work constitutes direct
or contributory patent infringement, then any patent licenses
granted to You under this License for that Work shall terminate
as of the date such litigation is filed.
4. Redistribution. You may reproduce and distribute copies of the
Work or Derivative Works thereof in any medium, with or without
modifications, and in Source or Object form, provided that You
meet the following conditions:
(a) You must give any other recipients of the Work or
Derivative Works a copy of this License; and
(b) You must cause any modified files to carry prominent notices
stating that You changed the files; and
(c) You must retain, in the Source form of any Derivative Works
that You distribute, all copyright, patent, trademark, and
attribution notices from the Source form of the Work,
excluding those notices that do not pertain to any part of
the Derivative Works; and
(d) If the Work includes a "NOTICE" text file as part of its
distribution, then any Derivative Works that You distribute must
include a readable copy of the attribution notices contained
within such NOTICE file, excluding those notices that do not
pertain to any part of the Derivative Works, in at least one
of the following places: within a NOTICE text file distributed
as part of the Derivative Works; within the Source form or
documentation, if provided along with the Derivative Works; or,
within a display generated by the Derivative Works, if and
wherever such third-party notices normally appear. The contents
of the NOTICE file are for informational purposes only and
do not modify the License. You may add Your own attribution
notices within Derivative Works that You distribute, alongside
or as an addendum to the NOTICE text from the Work, provided
that such additional attribution notices cannot be construed
as modifying the License.
You may add Your own copyright statement to Your modifications and
may provide additional or different license terms and conditions
for use, reproduction, or distribution of Your modifications, or
for any such Derivative Works as a whole, provided Your use,
reproduction, and distribution of the Work otherwise complies with
the conditions stated in this License.
5. Submission of Contributions. Unless You explicitly state otherwise,
any Contribution intentionally submitted for inclusion in the Work
by You to the Licensor shall be under the terms and conditions of
this License, without any additional terms or conditions.
Notwithstanding the above, nothing herein shall supersede or modify
the terms of any separate license agreement you may have executed
with Licensor regarding such Contributions.
6. Trademarks. This License does not grant permission to use the trade
names, trademarks, service marks, or product names of the Licensor,
except as required for reasonable and customary use in describing the
origin of the Work and reproducing the content of the NOTICE file.
7. Disclaimer of Warranty. Unless required by applicable law or
agreed to in writing, Licensor provides the Work (and each
Contributor provides its Contributions) on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
implied, including, without limitation, any warranties or conditions
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
PARTICULAR PURPOSE. You are solely responsible for determining the
appropriateness of using or redistributing the Work and assume any
risks associated with Your exercise of permissions under this License.
8. Limitation of Liability. In no event and under no legal theory,
whether in tort (including negligence), contract, or otherwise,
unless required by applicable law (such as deliberate and grossly
negligent acts) or agreed to in writing, shall any Contributor be
liable to You for damages, including any direct, indirect, special,
incidental, or consequential damages of any character arising as a
result of this License or out of the use or inability to use the
Work (including but not limited to damages for loss of goodwill,
work stoppage, computer failure or malfunction, or any and all
other commercial damages or losses), even if such Contributor
has been advised of the possibility of such damages.
9. Accepting Warranty or Additional Liability. While redistributing
the Work or Derivative Works thereof, You may choose to offer,
and charge a fee for, acceptance of support, warranty, indemnity,
or other liability obligations and/or rights consistent with this
License. However, in accepting such obligations, You may act only
on Your own behalf and on Your sole responsibility, not on behalf
of any other Contributor, and only if You agree to indemnify,
defend, and hold each Contributor harmless for any liability
incurred by, or claims asserted against, such Contributor by reason
of your accepting any such warranty or additional liability.
END OF TERMS AND CONDITIONS
APPENDIX: How to apply the Apache License to your work.
To apply the Apache License to your work, attach the following
boilerplate notice, with the fields enclosed by brackets "[]"
replaced with your own identifying information. (Don't include
the brackets!) The text should be enclosed in the appropriate
comment syntax for the file format. We also recommend that a
file or class name and description of purpose be included on the
same "printed page" as the copyright notice for easier
identification within third-party archives.
Copyright 2023 Aadi Desai
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

5
README.md Normal file
View file

@ -0,0 +1,5 @@
# omg-api: Library for interacting with the omg.lol API, used by the [omg](https://crates.io/crates/omg) crate
Separated out from the [omg](https://crates.io/crates/omg) crate for reuse and ease of updates.
Refer to the [changelog](CHANGELOG.md) for more information.

45
src/account.rs Normal file
View file

@ -0,0 +1,45 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Account {
/// Get information about your account
GetInfo,
/// Get all addresses associated with your account
GetAddresses,
/// Get the name associated with your account
GetName,
/// Update the name associated with your account
SetName {
/// Name to set for your account
name: String,
},
/// Get all sessions associated with your account
GetSessions,
/// Delete a session from your account
RemoveSession {
/// ID of the session to remove
session_id: String,
},
/// Get settings associated with your account
GetSettings,
/// Update settings associated with your account
SetSettings {
/// Temporary JSON data input
json_data: String,
},
}
impl Account {
pub fn process(&self, _email: &str) {
match self {
Account::GetInfo => todo!(),
Account::GetAddresses => todo!(),
Account::GetName => todo!(),
Account::SetName { name: _ } => todo!(),
Account::GetSessions => todo!(),
Account::RemoveSession { session_id: _ } => todo!(),
Account::GetSettings => todo!(),
Account::SetSettings { json_data: _ } => todo!(),
}
}
}

24
src/address.rs Normal file
View file

@ -0,0 +1,24 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Address {
/// Get information about the availability of an address
IsAvailable,
/// Get the expiration date for an address
GetExpiry,
/// Get limited (public) information about an address (no auth required)
GetPublicInfo,
///Get comprehensive information about an address
GetInfo,
}
impl Address {
pub fn process(&self) {
match self {
Address::IsAvailable => todo!(),
Address::GetExpiry => todo!(),
Address::GetPublicInfo => todo!(),
Address::GetInfo => todo!(),
}
}
}

33
src/dns.rs Normal file
View file

@ -0,0 +1,33 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Dns {
/// Get a list of all your DNS records
GetRecords,
/// Add a new DNS record
AddRecord {
/// Temporary JSON data input
json_data: String,
},
/// Update an existing DNS record
UpdateRecord {
/// Temporary JSON data input
json_data: String,
},
/// Delete a DNS record
DeleteRecord {
/// ID of the DNS record to delete
id: String,
},
}
impl Dns {
pub fn process(&self) {
match self {
Dns::GetRecords => todo!(),
Dns::AddRecord { json_data } => todo!(),
Dns::UpdateRecord { json_data } => todo!(),
Dns::DeleteRecord { id } => todo!(),
}
}
}

21
src/email.rs Normal file
View file

@ -0,0 +1,21 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Email {
/// Get forwarding address(es)
GetForwards,
/// Set forwarding address(es)
SetForwards {
/// Addresses to forward emails to
json_data: String,
},
}
impl Email {
pub fn process(&self) {
match self {
Email::GetForwards => todo!(),
Email::SetForwards { json_data } => todo!(),
}
}
}

159
src/lib.rs Normal file
View file

@ -0,0 +1,159 @@
use clap::Subcommand;
pub mod account;
pub use account::Account;
pub mod address;
pub use address::Address;
pub mod dns;
pub use dns::Dns;
pub mod email;
pub use email::Email;
pub mod now;
pub use now::Now;
pub mod pastebin;
pub use pastebin::Pastebin;
pub mod purl;
pub use purl::Purl;
pub mod status;
pub use status::Status;
pub mod theme;
pub use theme::Theme;
pub mod web;
pub use web::Web;
pub mod weblog;
pub use weblog::Weblog;
// TODO: allow content fields for some commands to provide filepaths, using the content of the file instead
#[derive(Subcommand)]
pub enum Commands {
/// Get information and make changes to your account
Account {
/// Email of your omg.lol account, needed for Account commands only
#[clap(short, long, global = true)]
email: String,
#[clap(subcommand)]
command: Account,
},
/// Get information and make changes to your addresses
Address {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Address,
},
/// Save your omg.lol API key to the config.json (Rather than using the OMGLOL_API_KEY environment variable)
Auth {
/// API key to save to config.json
api_key: String,
},
/// Get the address directory, consisting of addresses that have opted-in to be listed
Directory,
/// Adjust the switchboard / DNS records for your omg.lol address
Dns {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Dns,
},
/// Manage the email configuration for an omg.lol address
Email {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Email,
},
/// Manage your /now page
Now {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Now,
},
/// Manage the pastebin for an omg.lol address
Pastebin {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Pastebin,
},
/// Manage preferences for omg.lol accounts, addresses and objects
Preferences {
/// Account to change settings for
owner: String,
/// ID of setting to update
item: String,
/// Value to set "item" to
value: String,
},
/// Manage PURLs (Persistent URLs) for your omg.lol address
Purl {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Purl,
},
/// Get service information about omg.lol
Service,
/// Manage the statuslog for an omg.lol address
Status {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Status,
},
/// Manage omg.lol profile themes
Theme {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Theme,
},
/// Manage profile page and web stuff for an omg.lol address
Web {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Web,
},
/// Manage the weblog for an omg.lol address
Weblog {
/// omg.lol address to interact with
#[clap(short, long, global = true)]
address: Option<String>,
#[clap(subcommand)]
command: Weblog,
},
}
impl Commands {
fn process(&self) {
match self {
Commands::Account { email, command } => {
command.process(email);
}
Commands::Address { address, command } => todo!(),
Commands::Auth { api_key } => todo!(),
Commands::Directory => todo!(),
Commands::Dns { address, command } => todo!(),
Commands::Email { address, command } => todo!(),
Commands::Now { address, command } => todo!(),
Commands::Pastebin { address, command } => todo!(),
Commands::Preferences { owner, item, value } => todo!(),
Commands::Purl { address, command } => todo!(),
Commands::Service => todo!(),
Commands::Status { address, command } => todo!(),
Commands::Theme { address, command } => todo!(),
Commands::Web { address, command } => todo!(),
Commands::Weblog { address, command } => todo!(),
}
}
}

27
src/now.rs Normal file
View file

@ -0,0 +1,27 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Now {
/// Get the /now page for an address
Get,
/// Get all listed /now pages from now.garden
List,
/// Set the contents of the /now page for an address, remember to set the -l flag if you want your /now page listed
Set {
/// New content for the /now page
content: String,
/// List this /now page in now.garden
#[arg(short, long, default_value_t = false)]
listed: bool,
},
}
impl Now {
pub fn process(&self) {
match self {
Now::Get => todo!(),
Now::List => todo!(),
Now::Set { content, listed } => todo!(),
}
}
}

38
src/pastebin.rs Normal file
View file

@ -0,0 +1,38 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Pastebin {
/// Get a specific paste for an omg.lol address
Get {
/// Name of the paste to get
name: String,
},
/// Get all pastes for an omg.lol address
GetAll,
/// Get all public pastes for an omg.lol address
GetAllPublic,
/// Create/update a paste for an omg.lol address
Set {
/// Name of the paste to create (and the address used to retrieve it)
name: String,
/// Content of the paste
content: String,
},
/// Delete a paste for an omg.lol address
Delete {
/// Name of the paste to delete
name: String,
},
}
impl Pastebin {
pub fn process(&self) {
match self {
Pastebin::Get { name } => todo!(),
Pastebin::GetAll => todo!(),
Pastebin::GetAllPublic => todo!(),
Pastebin::Set { name, content } => todo!(),
Pastebin::Delete { name } => todo!(),
}
}
}

35
src/purl.rs Normal file
View file

@ -0,0 +1,35 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Purl {
/// Create a new PURL for an omg.lol address
Create {
/// Name of the PURL to create
name: String,
/// URL for the PURL to redirect to
url: String,
},
/// Get a specific PURL for an omg.lol address
Get {
/// Name of the PURL to get
name: String,
},
/// List all PURLs for an omg.lol address
List,
/// Delete a PURL for an omg.lol address
Delete {
/// Name of the PURL to delete
name: String,
},
}
impl Purl {
pub fn process(&self) {
match self {
Purl::Create { name, url } => todo!(),
Purl::Get { name } => todo!(),
Purl::List => todo!(),
Purl::Delete { name } => todo!(),
}
}
}

63
src/status.rs Normal file
View file

@ -0,0 +1,63 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Status {
/// Get a single statuslog entry for an omg.lol address
Get {
/// ID of the statuslog entry to get
id: String,
},
/// Get entire statuslog for an omg.lol address
GetAll,
/// Create a new statuslog entry for an omg.lol address
Create {
/// Emoji to use for the statuslog entry
emoji: String,
/// Content for the statuslog entry
content: String,
/// External URL to link to from the statuslog entry
external_url: String, // TODO: should this be optional?
},
/// Create a new statuslog entry for an omg.lol address from a single string
EasyCreate {
/// Status to share
status: String,
},
/// Update the content of an existing statuslog entry for an omg.lol address
Update {
/// ID of the statuslog entry to update
id: String,
/// New emoji to use for the statuslog entry
emoji: String,
/// New content for the statuslog entry
content: String,
// TODO: should there be an external url here?
},
/// Get a statuslog bio
GetBio,
/// Update a statuslog bio
SetBio {
/// New content for statuslog bio
content: String,
},
/// Get all statuslog entries for all addresses
GetAllHistorical,
/// Get the most recent statuslog entries across omg.lol
Timeline,
}
impl Status {
pub fn process(&self) {
match self {
Status::Get { id } => todo!(),
Status::GetAll => todo!(),
Status::Create { emoji, content, external_url } => todo!(),
Status::EasyCreate { status } => todo!(),
Status::Update { id, emoji, content } => todo!(),
Status::GetBio => todo!(),
Status::SetBio { content } => todo!(),
Status::GetAllHistorical => todo!(),
Status::Timeline => todo!(),
}
}
}

27
src/theme.rs Normal file
View file

@ -0,0 +1,27 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Theme {
/// List available omg.lol profile themes
List,
/// Get information about a specific theme
Info {
/// ID of the theme to get information for
id: String,
},
/// Get a preview (HTML) of a theme
Preview {
/// ID of the theme to get a preview (HTML) of
id: String,
},
}
impl Theme {
pub fn process(&self) {
match self {
Theme::List => todo!(),
Theme::Info { id } => todo!(),
Theme::Preview { id } => todo!(),
}
}
}

32
src/web.rs Normal file
View file

@ -0,0 +1,32 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Web {
/// Get web content and information for an omg.lol address
Get,
/// Update web content for an omg.lol address
Set {
/// New content for the web page
content: String,
/// Publish this page
#[arg(short, long, default_value_t = false)]
publish: bool,
},
/// Set profile picture for an omg.lol address
SetPFP {
/// Path to image to upload as new profile picture
image: String,
// TODO: #[arg(value_parser = fn_that_takes_str_ref_and_returns_result_pathbuf)]
// Eg: #[arg(value_parser = |arg: &str| -> Result<Duration, ParseIntError> {Ok(Duration::from_secs(arg.parse()?))})]
},
}
impl Web {
pub fn process(&self) {
match self {
Web::Get => todo!(),
Web::Set { content: _, publish: _ } => todo!(),
Web::SetPFP { image: _ } => todo!(),
}
}
}

54
src/weblog.rs Normal file
View file

@ -0,0 +1,54 @@
use clap::Subcommand;
#[derive(Subcommand)]
pub enum Weblog {
/// Get a specific weblog entry for an omg.lol address
Get {
/// ID of the weblog entry to get
id: String,
},
/// Get the latest weblog entry for an omg.lol address
Latest,
/// Get all weblog entries for an omg.lol address
GetAll,
/// Create a new weblog entry for an omg.lol address
Create {
/// Content for the weblog entry
content: String,
},
/// Delete a weblog entry for an omg.lol address
Delete {
/// ID of the weblog entry to delete
id: String,
},
/// Get weblog configuration for an omg.lol address
GetConfig,
/// Update weblog configuration for an omg.lol address
SetConfig {
/// Content for the weblog configuration entry
content: String,
},
/// Get the weblog template for an omg.lol address
GetTemplate,
/// Update the weblog template for an omg.lol address
SetTemplate {
/// Content for the weblog template entry
content: String,
},
}
impl Weblog {
pub fn process(&self, _address: &Option<String>) {
match self {
Weblog::Get { id: _ } => todo!(),
Weblog::Latest => todo!(),
Weblog::GetAll => todo!(),
Weblog::Create { content: _ } => todo!(),
Weblog::Delete { id: _ } => todo!(),
Weblog::GetConfig => todo!(),
Weblog::SetConfig { content: _ } => todo!(),
Weblog::GetTemplate => todo!(),
Weblog::SetTemplate { content: _ } => todo!(),
}
}
}