Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement UserVerify #13

Merged
merged 7 commits into from
Oct 7, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,84 @@ public string BaseUrl
partial void PrepareRequest(System.Net.Http.HttpClient client, System.Net.Http.HttpRequestMessage request, System.Text.StringBuilder urlBuilder);
partial void ProcessResponse(System.Net.Http.HttpClient client, System.Net.Http.HttpResponseMessage response);

/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual System.Threading.Tasks.Task<BooleanMessageContract> VerifyUserNameAsync(VerifyEmailAddressContract body)
{
return VerifyUserNameAsync(body, System.Threading.CancellationToken.None);
}

/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual async System.Threading.Tasks.Task<BooleanMessageContract> VerifyUserNameAsync(VerifyEmailAddressContract body, System.Threading.CancellationToken cancellationToken)
{
var urlBuilder_ = new System.Text.StringBuilder();
urlBuilder_.Append(BaseUrl != null ? BaseUrl.TrimEnd('/') : "").Append("/api/Users/VerifyUserName");

var client_ = _httpClient;
var disposeClient_ = false;
try
{
using (var request_ = new System.Net.Http.HttpRequestMessage())
{
var json_ = Newtonsoft.Json.JsonConvert.SerializeObject(body, _settings.Value);
var content_ = new System.Net.Http.StringContent(json_);
content_.Headers.ContentType = System.Net.Http.Headers.MediaTypeHeaderValue.Parse("application/json");
request_.Content = content_;
request_.Method = new System.Net.Http.HttpMethod("POST");
request_.Headers.Accept.Add(System.Net.Http.Headers.MediaTypeWithQualityHeaderValue.Parse("text/plain"));

PrepareRequest(client_, request_, urlBuilder_);

var url_ = urlBuilder_.ToString();
request_.RequestUri = new System.Uri(url_, System.UriKind.RelativeOrAbsolute);

PrepareRequest(client_, request_, url_);

var response_ = await client_.SendAsync(request_, System.Net.Http.HttpCompletionOption.ResponseHeadersRead, cancellationToken).ConfigureAwait(false);
var disposeResponse_ = true;
try
{
var headers_ = System.Linq.Enumerable.ToDictionary(response_.Headers, h_ => h_.Key, h_ => h_.Value);
if (response_.Content != null && response_.Content.Headers != null)
{
foreach (var item_ in response_.Content.Headers)
headers_[item_.Key] = item_.Value;
}

ProcessResponse(client_, response_);

var status_ = (int)response_.StatusCode;
if (status_ == 200)
{
var objectResponse_ = await ReadObjectResponseAsync<BooleanMessageContract>(response_, headers_, cancellationToken).ConfigureAwait(false);
if (objectResponse_.Object == null)
{
throw new ApiException("Response was null which was not expected.", status_, objectResponse_.Text, headers_, null);
}
return objectResponse_.Object;
}
else
{
var responseData_ = response_.Content == null ? null : await response_.Content.ReadAsStringAsync().ConfigureAwait(false);
throw new ApiException("The HTTP status code of the response was not expected (" + status_ + ").", status_, responseData_, headers_, null);
}
}
finally
{
if (disposeResponse_)
response_.Dispose();
}
}
}
finally
{
if (disposeClient_)
client_.Dispose();
}
}

/// <returns>Success</returns>
/// <exception cref="ApiException">A server side error occurred.</exception>
public virtual System.Threading.Tasks.Task<Int64MessageContract> RegisterAsync(AddUserRequestContract body)
Expand Down Expand Up @@ -1208,6 +1286,68 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
}
}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
public partial class BooleanMessageContract : System.ComponentModel.INotifyPropertyChanged
{
private bool _isSuccess;
private ErrorContract _error;
private bool _result;

[Newtonsoft.Json.JsonProperty("isSuccess", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool IsSuccess
{
get { return _isSuccess; }

set
{
if (_isSuccess != value)
{
_isSuccess = value;
RaisePropertyChanged();
}
}
}

[Newtonsoft.Json.JsonProperty("error", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public ErrorContract Error
{
get { return _error; }

set
{
if (_error != value)
{
_error = value;
RaisePropertyChanged();
}
}
}

[Newtonsoft.Json.JsonProperty("result", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool Result
{
get { return _result; }

set
{
if (_result != value)
{
_result = value;
RaisePropertyChanged();
}
}
}

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
public partial class ClaimContract : System.ComponentModel.INotifyPropertyChanged
{
Expand Down Expand Up @@ -1767,6 +1907,7 @@ public partial class UserContract : System.ComponentModel.INotifyPropertyChanged
private System.DateTimeOffset? _modificationDateTime;
private bool _isDeleted;
private System.DateTimeOffset? _deletedDateTime;
private bool _isUsernameVerified;

[Newtonsoft.Json.JsonProperty("id", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long Id
Expand Down Expand Up @@ -1888,6 +2029,21 @@ public System.DateTimeOffset? DeletedDateTime
}
}

[Newtonsoft.Json.JsonProperty("isUsernameVerified", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public bool IsUsernameVerified
{
get { return _isUsernameVerified; }

set
{
if (_isUsernameVerified != value)
{
_isUsernameVerified = value;
RaisePropertyChanged();
}
}
}

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
Expand Down Expand Up @@ -2206,6 +2362,36 @@ protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.Cal
}
}

[System.CodeDom.Compiler.GeneratedCode("NJsonSchema", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
public partial class VerifyEmailAddressContract : System.ComponentModel.INotifyPropertyChanged
{
private long _userId;

[Newtonsoft.Json.JsonProperty("userId", Required = Newtonsoft.Json.Required.DisallowNull, NullValueHandling = Newtonsoft.Json.NullValueHandling.Ignore)]
public long UserId
{
get { return _userId; }

set
{
if (_userId != value)
{
_userId = value;
RaisePropertyChanged();
}
}
}

public event System.ComponentModel.PropertyChangedEventHandler PropertyChanged;

protected virtual void RaisePropertyChanged([System.Runtime.CompilerServices.CallerMemberName] string propertyName = null)
{
var handler = PropertyChanged;
if (handler != null)
handler(this, new System.ComponentModel.PropertyChangedEventArgs(propertyName));
}
}



[System.CodeDom.Compiler.GeneratedCode("NSwag", "13.19.0.0 (NJsonSchema v10.9.0.0 (Newtonsoft.Json v13.0.3.0))")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,55 @@
"version": "1.0"
},
"paths": {
"/api/Users/VerifyUserName": {
"post": {
"tags": [
"Users"
],
"operationId": "VerifyUserName",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/VerifyEmailAddressContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/VerifyEmailAddressContract"
}
},
"application/*+json": {
"schema": {
"$ref": "#/components/schemas/VerifyEmailAddressContract"
}
}
}
},
"responses": {
"200": {
"description": "Success",
"content": {
"text/plain": {
"schema": {
"$ref": "#/components/schemas/BooleanMessageContract"
}
},
"application/json": {
"schema": {
"$ref": "#/components/schemas/BooleanMessageContract"
}
},
"text/json": {
"schema": {
"$ref": "#/components/schemas/BooleanMessageContract"
}
}
}
}
}
}
},
"/api/Users/Register": {
"post": {
"tags": [
Expand Down Expand Up @@ -621,6 +670,22 @@
}
}
},
"BooleanMessageContract": {
"title": "MessageContract<Boolean>",
"type": "object",
"additionalProperties": false,
"properties": {
"isSuccess": {
"type": "boolean"
},
"error": {
"$ref": "#/components/schemas/ErrorContract"
},
"result": {
"type": "boolean"
}
}
},
"ClaimContract": {
"type": "object",
"additionalProperties": false,
Expand Down Expand Up @@ -863,6 +928,9 @@
"type": "string",
"format": "date-time",
"nullable": true
},
"isUsernameVerified": {
"type": "boolean"
}
}
},
Expand Down Expand Up @@ -956,6 +1024,16 @@
"nullable": true
}
}
},
"VerifyEmailAddressContract": {
"type": "object",
"additionalProperties": false,
"properties": {
"userId": {
"type": "integer",
"format": "int64"
}
}
}
},
"securitySchemes": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<Platforms>AnyCPU;x64;x86</Platforms>
<Authors>EasyMicroservices</Authors>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<Version>0.0.0.6</Version>
<Version>0.0.0.7</Version>
<Description>client generated code.</Description>
<Copyright>[email protected]</Copyright>
<PackageTags>microservice,auth,authentication,client</PackageTags>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@ public class UserSchema : IUniqueIdentitySchema, ISoftDeleteSchema, IDateTimeSch
public DateTime? ModificationDateTime { get; set; }
public bool IsDeleted { get; set; }
public DateTime? DeletedDateTime { get; set; }
public bool IsUsernameVerified { get; set; }
}
}
Loading
Loading