Skip to content

Commit 8cab0a3

Browse files
committed
feat: accept invite
chore: update sdk
1 parent ea38bd4 commit 8cab0a3

17 files changed

Lines changed: 231 additions & 32 deletions

envx_sdk/.openapi-generator/FILES

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
Cargo.toml
44
README.md
55
docs/AcceptInviteBody.md
6+
docs/AcceptInviteReturnType.md
67
docs/DefaultApi.md
78
docs/InviteApi.md
89
docs/InviteBody.md
@@ -17,6 +18,7 @@ docs/ProjectsApi.md
1718
docs/RemoveUserBody.md
1819
docs/SetManyBody.md
1920
docs/StrippedUser.md
21+
docs/UpdateManyBody.md
2022
docs/UpdateProjectV2.md
2123
docs/User.md
2224
docs/UserApi.md
@@ -34,6 +36,7 @@ src/apis/user_api.rs
3436
src/apis/variables_api.rs
3537
src/lib.rs
3638
src/models/accept_invite_body.rs
39+
src/models/accept_invite_return_type.rs
3740
src/models/invite_body.rs
3841
src/models/invite_response.rs
3942
src/models/list_projects_v2.rs
@@ -45,6 +48,7 @@ src/models/project_info_v2.rs
4548
src/models/remove_user_body.rs
4649
src/models/set_many_body.rs
4750
src/models/stripped_user.rs
51+
src/models/update_many_body.rs
4852
src/models/update_project_v2.rs
4953
src/models/user.rs
5054
src/models/variable.rs

envx_sdk/README.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ All URIs are relative to *http://localhost*
2727
Class | Method | HTTP request | Description
2828
------------ | ------------- | ------------- | -------------
2929
*DefaultApi* | [**health_check**](docs/DefaultApi.md#health_check) | **GET** /.well-known/health-check | Get health of the API.
30-
*InviteApi* | [**accept_invite**](docs/InviteApi.md#accept_invite) | **POST** /v2/invite/accept/{invite_code} |
30+
*InviteApi* | [**accept_invite**](docs/InviteApi.md#accept_invite) | **POST** /v2/invite/accept |
3131
*InviteApi* | [**new_invite**](docs/InviteApi.md#new_invite) | **POST** /v2/invite/new |
3232
*ProjectApi* | [**add_user**](docs/ProjectApi.md#add_user) | **POST** /v2/project/{project_id} |
3333
*ProjectApi* | [**get_project_info_v2**](docs/ProjectApi.md#get_project_info_v2) | **GET** /v2/project/{project_id} |
@@ -48,6 +48,7 @@ Class | Method | HTTP request | Description
4848
## Documentation For Models
4949

5050
- [AcceptInviteBody](docs/AcceptInviteBody.md)
51+
- [AcceptInviteReturnType](docs/AcceptInviteReturnType.md)
5152
- [InviteBody](docs/InviteBody.md)
5253
- [InviteResponse](docs/InviteResponse.md)
5354
- [ListProjectsV2](docs/ListProjectsV2.md)
@@ -58,6 +59,7 @@ Class | Method | HTTP request | Description
5859
- [RemoveUserBody](docs/RemoveUserBody.md)
5960
- [SetManyBody](docs/SetManyBody.md)
6061
- [StrippedUser](docs/StrippedUser.md)
62+
- [UpdateManyBody](docs/UpdateManyBody.md)
6163
- [UpdateProjectV2](docs/UpdateProjectV2.md)
6264
- [User](docs/User.md)
6365
- [Variable](docs/Variable.md)

envx_sdk/docs/AcceptInviteBody.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**verifier** | **String** | |
7+
**code** | [**uuid::Uuid**](uuid::Uuid.md) | |
8+
**verifier** | [**uuid::Uuid**](uuid::Uuid.md) | |
89

910
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
1011

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# AcceptInviteReturnType
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**ciphertext** | **String** | |
8+
**id** | **String** | |
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+

envx_sdk/docs/InviteApi.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,27 +4,26 @@ All URIs are relative to *http://localhost*
44

55
Method | HTTP request | Description
66
------------- | ------------- | -------------
7-
[**accept_invite**](InviteApi.md#accept_invite) | **POST** /v2/invite/accept/{invite_code} |
7+
[**accept_invite**](InviteApi.md#accept_invite) | **POST** /v2/invite/accept |
88
[**new_invite**](InviteApi.md#new_invite) | **POST** /v2/invite/new |
99

1010

1111

1212
## accept_invite
1313

14-
> String accept_invite(invite_code, accept_invite_body)
14+
> models::AcceptInviteReturnType accept_invite(accept_invite_body)
1515
1616

1717
### Parameters
1818

1919

2020
Name | Type | Description | Required | Notes
2121
------------- | ------------- | ------------- | ------------- | -------------
22-
**invite_code** | **uuid::Uuid** | | [required] |
2322
**accept_invite_body** | [**AcceptInviteBody**](AcceptInviteBody.md) | | [required] |
2423

2524
### Return type
2625

27-
**String**
26+
[**models::AcceptInviteReturnType**](AcceptInviteReturnType.md)
2827

2928
### Authorization
3029

@@ -33,7 +32,7 @@ Name | Type | Description | Required | Notes
3332
### HTTP request headers
3433

3534
- **Content-Type**: application/json
36-
- **Accept**: text/plain
35+
- **Accept**: application/json
3736

3837
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
3938

envx_sdk/docs/UpdateManyBody.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# UpdateManyBody
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**variables** | [**Vec<models::Variable>**](Variable.md) | |
8+
9+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10+
11+

envx_sdk/docs/Variable.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44

55
Name | Type | Description | Notes
66
------------ | ------------- | ------------- | -------------
7-
**id** | [**uuid::Uuid**](uuid::Uuid.md) | |
8-
**project_id** | [**uuid::Uuid**](uuid::Uuid.md) | |
7+
**id** | **String** | |
8+
**project_id** | **String** | |
99
**value** | **String** | |
1010

1111
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

envx_sdk/docs/VariablesApi.md

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -97,25 +97,28 @@ Name | Type | Description | Required | Notes
9797

9898
## update_many
9999

100-
> update_many()
100+
> Vec<String> update_many(update_many_body)
101101
102102

103103
### Parameters
104104

105-
This endpoint does not need any parameter.
105+
106+
Name | Type | Description | Required | Notes
107+
------------- | ------------- | ------------- | ------------- | -------------
108+
**update_many_body** | [**UpdateManyBody**](UpdateManyBody.md) | | [required] |
106109

107110
### Return type
108111

109-
(empty response body)
112+
**Vec<String>**
110113

111114
### Authorization
112115

113116
[bearer](../README.md#bearer)
114117

115118
### HTTP request headers
116119

117-
- **Content-Type**: Not defined
118-
- **Accept**: Not defined
120+
- **Content-Type**: application/json
121+
- **Accept**: application/json
119122

120123
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
121124

envx_sdk/src/apis/invite_api.rs

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -34,12 +34,11 @@ pub enum NewInviteError {
3434
}
3535

3636

37-
pub async fn accept_invite(configuration: &configuration::Configuration, invite_code: &str, accept_invite_body: models::AcceptInviteBody) -> Result<String, Error<AcceptInviteError>> {
37+
pub async fn accept_invite(configuration: &configuration::Configuration, accept_invite_body: models::AcceptInviteBody) -> Result<models::AcceptInviteReturnType, Error<AcceptInviteError>> {
3838
// add a prefix to parameters to efficiently prevent name collisions
39-
let p_path_invite_code = invite_code;
4039
let p_body_accept_invite_body = accept_invite_body;
4140

42-
let uri_str = format!("{}/v2/invite/accept/{invite_code}", configuration.base_path, invite_code=crate::apis::urlencode(p_path_invite_code));
41+
let uri_str = format!("{}/v2/invite/accept", configuration.base_path);
4342
let mut req_builder = configuration.client.request(reqwest::Method::POST, &uri_str);
4443

4544
if let Some(ref user_agent) = configuration.user_agent {
@@ -65,8 +64,8 @@ pub async fn accept_invite(configuration: &configuration::Configuration, invite_
6564
let content = resp.text().await?;
6665
match content_type {
6766
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
68-
ContentType::Text => return Ok(content),
69-
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `String`")))),
67+
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `models::AcceptInviteReturnType`"))),
68+
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `models::AcceptInviteReturnType`")))),
7069
}
7170
} else {
7271
let content = resp.text().await?;

envx_sdk/src/apis/variables_api.rs

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ pub enum SetManyError {
4141
#[derive(Debug, Clone, Serialize, Deserialize)]
4242
#[serde(untagged)]
4343
pub enum UpdateManyError {
44+
Status400(),
4445
UnknownValue(serde_json::Value),
4546
}
4647

@@ -141,7 +142,9 @@ pub async fn set_many(configuration: &configuration::Configuration, set_many_bod
141142
}
142143
}
143144

144-
pub async fn update_many(configuration: &configuration::Configuration, ) -> Result<(), Error<UpdateManyError>> {
145+
pub async fn update_many(configuration: &configuration::Configuration, update_many_body: models::UpdateManyBody) -> Result<Vec<String>, Error<UpdateManyError>> {
146+
// add a prefix to parameters to efficiently prevent name collisions
147+
let p_body_update_many_body = update_many_body;
145148

146149
let uri_str = format!("{}/v2/variables/update-many", configuration.base_path);
147150
let mut req_builder = configuration.client.request(reqwest::Method::PUT, &uri_str);
@@ -152,14 +155,26 @@ pub async fn update_many(configuration: &configuration::Configuration, ) -> Resu
152155
if let Some(ref token) = configuration.bearer_access_token {
153156
req_builder = req_builder.bearer_auth(token.to_owned());
154157
};
158+
req_builder = req_builder.json(&p_body_update_many_body);
155159

156160
let req = req_builder.build()?;
157161
let resp = configuration.client.execute(req).await?;
158162

159163
let status = resp.status();
164+
let content_type = resp
165+
.headers()
166+
.get("content-type")
167+
.and_then(|v| v.to_str().ok())
168+
.unwrap_or("application/octet-stream");
169+
let content_type = super::ContentType::from(content_type);
160170

161171
if !status.is_client_error() && !status.is_server_error() {
162-
Ok(())
172+
let content = resp.text().await?;
173+
match content_type {
174+
ContentType::Json => serde_json::from_str(&content).map_err(Error::from),
175+
ContentType::Text => return Err(Error::from(serde_json::Error::custom("Received `text/plain` content type response that cannot be converted to `Vec&lt;String&gt;`"))),
176+
ContentType::Unsupported(unknown_type) => return Err(Error::from(serde_json::Error::custom(format!("Received `{unknown_type}` content type response that cannot be converted to `Vec&lt;String&gt;`")))),
177+
}
163178
} else {
164179
let content = resp.text().await?;
165180
let entity: Option<UpdateManyError> = serde_json::from_str(&content).ok();

0 commit comments

Comments
 (0)