Rust API for simwood-rs
The Simwood Customer API ("Application Programming Interface") is a way for your own back-office systems and web sites to seamlessly integrate with Simwood and manage your wholesale telephony account and services.
Overview
This client/server was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.
To see how to make this your own, look here:
README
- API version: 1.0.0
- Build date: 2019-10-13T11:28:33.423+01:00[Europe/London]
For more information, please visit https://support.simwood.com/
This autogenerated project defines an API crate simwood-rs
which contains:
- An
Api
trait defining the API in Rust. - Data types representing the underlying data model.
- A
Client
type which implementsApi
and issues HTTP requests for each operation. - A router which accepts HTTP requests and invokes the appropriate
Api
method for each operation.
It also contains an example server and client which make use of simwood-rs
:
- The example server starts up a web server using the
simwood-rs
router, and supplies a trivial implementation ofApi
which returns failure for every operation. - The example client provides a CLI which lets you invoke
any single operation on the
simwood-rs
client by passing appropriate arguments on the command line.
You can use the example server and client as a basis for your own code. See below for more detail on implementing a server.
Examples
Run examples with:
cargo run --example <example-name>
To pass in arguments to the examples, put them after --
, for example:
cargo run --example client -- --help
Running the example server
To run the server, follow these simple steps:
cargo run --example server
Running the example client
To run a client, follow one of the following simple steps:
cargo run --example client GetAccountType
cargo run --example client DeleteAllocatedNumber
cargo run --example client DeleteNumberConfig
cargo run --example client GetAllocatedNumber
cargo run --example client GetAllocatedNumbers
cargo run --example client GetAvailableNumbers
cargo run --example client GetNumberConfig
cargo run --example client GetNumberRanges
cargo run --example client PutAllocatedNumber
cargo run --example client PutNumberConfig
cargo run --example client DeleteOutboundAclIp
cargo run --example client DeleteOutboundTrunk
cargo run --example client GetOutboundAclIps
cargo run --example client GetOutboundTrunk
cargo run --example client GetOutboundTrunks
cargo run --example client PutOutboundAclIp
cargo run --example client PutOutboundTrunk
cargo run --example client GetMyIp
cargo run --example client GetTime
HTTPS
The examples can be run in HTTPS mode by passing in the flag --https
, for example:
cargo run --example server -- --https
This will use the keys/certificates from the examples directory. Note that the
server chain is signed with CN=localhost
.
Using the generated library
The generated library has a few optional features that can be activated through Cargo.
server
- This defaults to enabled and creates the basic skeleton of a server implementation based on hyper
- To create the server stack you'll need to provide an implementation of the API trait to provide the server function.
client
- This defaults to enabled and creates the basic skeleton of a client implementation based on hyper
- The constructed client implements the API trait by making remote API call.
conversions
- This defaults to disabled and creates extra derives on models to allow "transmogrification" between objects of structurally similar types.
See https://doc.rust-lang.org/cargo/reference/manifest.html#the-features-section for how to use features in your Cargo.toml
.
Documentation for API Endpoints
All URIs are relative to https://api.simwood.com/v3
Method | HTTP request | Description |
---|---|---|
getAccountType | GET /accounts/{account}/type | Get your current account type, and limitations |
deleteAllocatedNumber | DELETE /numbers/{account}/allocated/{number} | De-configure and irrevocably remove number from account |
deleteNumberConfig | DELETE /numbers/{account}/allocated/{number}/config | De-configure the configuration of number |
getAllocatedNumber | GET /numbers/{account}/allocated/{number} | Return configuration information on allocated number |
getAllocatedNumbers | POST /numbers/{account}/allocated/all | Request a report of all current allocated numbers on account |
getAvailableNumbers | GET /numbers/{account}/available/{tier}/{number} | Returns 1,10 or 100 numbers available for allocation matching the pattern specified |
getNumberConfig | GET /numbers/{account}/allocated/{number}/config | Return configuration information on allocated number |
getNumberRanges | GET /numbers/{account}/ranges | Retrieves a list of all available number ranges, including descriptions |
putAllocatedNumber | PUT /numbers/{account}/allocated/{number} | Allocate an available number to the account |
putNumberConfig | PUT /numbers/{account}/allocated/{number}/config | Replace active configuration for number |
deleteOutboundAclIp | DELETE /voice/{account}/outbound/{trunk}/acl/{ip} | Remove IP from ACL-based trunk |
deleteOutboundTrunk | DELETE /voice/{account}/outbound/{trunk} | Delete the trunk |
getOutboundAclIps | GET /voice/{account}/outbound/{trunk}/acl | Request information of specified trunk |
getOutboundTrunk | GET /voice/{account}/outbound/{trunk} | Request information of specified trunk |
getOutboundTrunks | GET /voice/{account}/outbound | List all active outbound trunks |
putOutboundAclIp | PUT /voice/{account}/outbound/{trunk}/acl/{ip} | Add IP to ACL-based trunk |
putOutboundTrunk | PUT /voice/{account}/outbound/{trunk} | Create new trunk or update existing trunk |
getMyIp | GET /tools/myip | Return your external IP address, as seen by the Simwood API |
getTime | GET /tools/time | Returns the current timestamp |
Documentation For Models
- AccountType
- AccountTypeResponse
- AllocatedNumber999
- AllocatedNumberBasic
- AllocatedNumberFax
- AllocatedNumberResponse
- AllocatedNumberSms
- AllocatedNumberVoice
- AllocatedNumbersResponse
- AvailableNumber
- AvailableNumbersResponse
- Errors
- MyIp
- NumberConfig
- NumberConfigOptions
- NumberRange
- NumberRangesResponse
- OutboundAclIp
- OutboundAclIps
- OutboundTrunk
- OutboundTrunkSummary
- OutboundTrunksResponse
- PutNumberConfigResponse
- RoutingEntry
- Time
Documentation For Authorization
BasicAuth
- Type: HTTP basic authentication
Example