johnolos / sbanken-cli Goto Github PK
View Code? Open in Web Editor NEWA terminal-cli written in rust for sbanken.no
A terminal-cli written in rust for sbanken.no
Sbanken with #1 decided to use account_id
instead of account_nr
.
Account_id is a long hexadecimal, which not only is hard to read, seems estranged to the user.
Going forward, sbanken-cli
will expect account_nr
instead of account_id
, and will do the conversion to account_id
behind the scenes before calling the respective APIs.
Update May 2018
We have stopped using customerId as a part of the API URL. Instead we require all API requests to include the customerId as a http header. See swagger for more information.
We have rolled back all APIs to start on V1
We have stopped using AccountNumber as part of the URL. Instead we require all Account API requests to include the AccountId as retrieved from HTTP GET /Bank/api/v1/Accounts (see powershell script example)
Update of IdentityServer requires Clients to form-urlencode ClientId and Secret prior to Base64-encoding the Authorization header. This is according to specification in RFC6749. See DotNetCoreSampleApplication (updated to IdentityModel 3.6.1 which does this automatically) and ShellScripts example.
Build fails!
Anything I can do on my side? Don't know rust (yet), but afaik appears code needs various minor patches for deprecated rust functionality.
λ sw_vers -productVersion; sw_vers -buildVersion;uname -a; which zsh;zsh --version; systemstats|head -n 16; rustc --version
10.15.4
19E287
Darwin 10core.local 19.4.0 Darwin Kernel Version 19.4.0: Wed Mar 4 22:28:40 PST 2020; root:xnu-6153.101.6~15/RELEASE_X86_64 x86_64
/usr/local/bin/zsh
zsh 5.8 (x86_64-apple-darwin19.3.0)
Summary
=======
System Version: 19E287
Hardware Model: iMacPro1,1
Board ID: Mac-7BA5B2D9E42DDD94
Installed Memory Size: 64GB (68719476736)
Page Size: 4096
Root Volume Type: SSD:1,HDD:0,FUSION:0,FDE:1,RAID:0,TINYSSD:0,IN:1,EX:0,INEX:0,APFS
Root Volume Size: 1773GB (1904000081920)
SSD Name: APPLE SSD AP2048M
SSD Revision: 717.100.
Discrete GPU Present: 0
Total Time: 183:19:12
Dashboard Start: 2020-05-18 00:24:41
Dashboard End: 2020-05-25 15:43:41
rustc 1.43.1
λ cargo build --release master?
Compiling sbanken-cli v0.4.0 (/Users/storm/Dropbox/Kode/sbanken-cli)
error[E0432]: unresolved imports `hyper::header::Accept`, `hyper::header::Authorization`, `hyper::header::Basic`, `hyper::header::Bearer`, `hyper::header::ContentType`, `hyper::header::Headers`, `hyper::header::UserAgent`
--> src/core/authorize.rs:4:21
|
4 | use hyper::header::{Accept, Authorization, Basic, Bearer, ContentType, Headers, UserAgent};
| ^^^^^^ ^^^^^^^^^^^^^ ^^^^^ ^^^^^^ ^^^^^^^^^^^ ^^^^^^^ ^^^^^^^^^ no `UserAgent` in `header`
| | | | | | |
| | | | | | no `Headers` in `header`
| | | | | no `ContentType` in `header`
| | | | no `Bearer` in `header`
| | | no `Basic` in `header`
| | no `Authorization` in `header`
| no `Accept` in `header`
warning: trait objects without an explicit `dyn` are deprecated
--> src/core/error.rs:34:32
|
34 | fn cause(&self) -> Option<&error::Error> {
| ^^^^^^^^^^^^ help: use `dyn`: `dyn error::Error`
|
= note: `#[warn(bare_trait_objects)]` on by default
error[E0277]: cannot subtract `time::Duration` from `chrono::DateTime<chrono::Utc>`
--> src/main.rs:159:30
|
159 | None => end_date - Duration::days(30),
| ^ no implementation for `chrono::DateTime<chrono::Utc> - time::Duration`
|
= help: the trait `std::ops::Sub<time::Duration>` is not implemented for `chrono::DateTime<chrono::Utc>`
error[E0277]: the `?` operator can only be applied to values that implement `std::ops::Try`
--> src/core/authorize.rs:35:28
|
35 | let mut response = client
| ____________________________^
36 | | .post(Authorize::IDENTITY_SERVER_URL)
37 | | .body("grant_type=client_credentials")
38 | | .send()?;
| |____________________^ the `?` operator cannot be applied to type `impl std::future::Future`
|
= help: the trait `std::ops::Try` is not implemented for `impl std::future::Future`
= note: required by `std::ops::Try::into_result`
error[E0308]: mismatched types
--> src/core/authorize.rs:65:20
|
57 | ) -> Result<Response, Error> {
| ----------------------- expected because this return type...
58 | let token: AccessToken = self.get_access_token()?;
| - ...is found to be `std::result::Result<reqwest::Response, reqwest::Error>` here
...
65 | return client.get(url).query(¶ms).send();
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found opaque type
|
::: /Users/storm/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.10.4/src/async_impl/request.rs:397:26
|
397 | pub fn send(self) -> impl Future<Output = Result<Response, crate::Error>> {
| ---------------------------------------------------- the found opaque type
|
= note: expected type `std::result::Result<reqwest::Response, reqwest::Error>`
found opaque type `impl std::future::Future`
= note: to return `impl Trait`, all returned values must be of the same type
= note: for information on `impl Trait`, see <https://doc.rust-lang.org/book/ch10-02-traits.html#returning-types-that-implement-traits>
= help: alternatively, create a new `enum` with a variant for each returned type
error[E0308]: mismatched types
--> src/core/authorize.rs:68:9
|
57 | ) -> Result<Response, Error> {
| ----------------------- expected `std::result::Result<reqwest::Response, reqwest::Error>` because of return type
...
68 | client.get(url).send()
| ^^^^^^^^^^^^^^^^^^^^^^ expected enum `std::result::Result`, found opaque type
|
::: /Users/storm/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.10.4/src/async_impl/request.rs:397:26
|
397 | pub fn send(self) -> impl Future<Output = Result<Response, crate::Error>> {
| ---------------------------------------------------- the found opaque type
|
= note: expected enum `std::result::Result<reqwest::Response, reqwest::Error>`
found opaque type `impl std::future::Future`
error[E0308]: mismatched types
--> src/core/authorize.rs:77:9
|
71 | pub fn post_request(&self, url: Url, object: impl Serialize) -> Result<Response, Error> {
| ----------------------- expected `std::result::Result<reqwest::Response, reqwest::Error>` because of return type
...
77 | / client
78 | | .post(url)
79 | | .body(serde_json::to_string(&object).unwrap())
80 | | .send()
| |___________________^ expected enum `std::result::Result`, found opaque type
|
::: /Users/storm/.cargo/registry/src/github.com-1ecc6299db9ec823/reqwest-0.10.4/src/async_impl/request.rs:397:26
|
397 | pub fn send(self) -> impl Future<Output = Result<Response, crate::Error>> {
| ---------------------------------------------------- the found opaque type
|
= note: expected enum `std::result::Result<reqwest::Response, reqwest::Error>`
found opaque type `impl std::future::Future`
error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
--> src/core/bank.rs:22:18
|
22 | response.json::<Accounts>()
| ^^^^ method not found in `reqwest::Response`
error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
--> src/core/bank.rs:34:18
|
34 | response.json::<Account>()
| ^^^^ method not found in `reqwest::Response`
error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
--> src/core/bank.rs:63:18
|
63 | response.json::<Transactions>()
| ^^^^ method not found in `reqwest::Response`
error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
--> src/core/bank.rs:71:18
|
71 | response.json::<TransferResponse>()
| ^^^^ method not found in `reqwest::Response`
error[E0599]: no method named `json` found for struct `reqwest::Response` in the current scope
--> src/core/customers.rs:20:18
|
20 | response.json::<Customer>()
| ^^^^ method not found in `reqwest::Response`
warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
--> src/core/error.rs:24:44
|
24 | Error::Reqwest(ref err) => err.description(),
| ^^^^^^^^^^^
|
= note: `#[warn(deprecated)]` on by default
warning: use of deprecated item 'std::error::Error::description': use the Display impl or to_string()
--> src/core/error.rs:26:42
|
26 | Error::Regex(ref err) => err.description(),
| ^^^^^^^^^^^
error: aborting due to 11 previous errors
Some errors have detailed explanations: E0277, E0308, E0432, E0599.
For more information about an error, try `rustc --explain E0277`.
error: could not compile `sbanken-cli`.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.