This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public async Task<(bool success, string message)> SendMessage(string messageId) | |
| { | |
| try | |
| { | |
| await graphClient.Me.Messages[messageId] | |
| .Send() | |
| .Request() | |
| .PostAsync(); | |
| return (true, null); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private async Task<bool> MessageCreateUploadSession(string messageId, string fileName, byte[] bytes) | |
| { | |
| try | |
| { | |
| using (Stream stream = new MemoryStream(bytes)) | |
| { | |
| var attachmentItem = new AttachmentItem | |
| { | |
| AttachmentType = AttachmentType.File, | |
| Name = fileName, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var attachment = new FileAttachment | |
| { | |
| Name = fileName, | |
| ContentBytes = bytes | |
| }; | |
| await graphClient.Me.Messages[messageId].Attachments | |
| .Request() | |
| .AddAsync(attachment).ConfigureAwait(false); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private async Task DeleteMessage(string messageId) | |
| { | |
| try | |
| { | |
| await graphClient.Me.Messages[messageId] | |
| .Request() | |
| .DeleteAsync(); | |
| } | |
| catch (Exception ex) | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public async Task<string> CreateDraftMessage(string messageId, IList<string> toEmails, string subject, string body) | |
| { | |
| if (toEmails == null || !toEmails.Any() || string.IsNullOrEmpty(subject) || string.IsNullOrEmpty(body)) | |
| { | |
| return null; | |
| } | |
| var message = new Message | |
| { | |
| Subject = subject, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private GraphServiceClient CreateGraphClientAsync(string token) | |
| { | |
| return new GraphServiceClient( | |
| new DelegateAuthenticationProvider( | |
| (request) => | |
| { | |
| if (!string.IsNullOrEmpty(token)) | |
| { | |
| request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", token); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| [HttpGet] | |
| [SwaggerResponse(System.Net.HttpStatusCode.NotFound, "Customer not found or no access", typeof(ErrorMessageVo))] | |
| public CustomerGetResponseVo Get(int id) | |
| { | |
| return new CustomerGetResponseVo(); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ApplyDocumentFilter : IDocumentFilter | |
| { | |
| public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer) | |
| { | |
| swaggerDoc.info = GetInfo(); | |
| swaggerDoc.securityDefinitions = GetSecurityDefinitions(); | |
| var tagGroups = GetTagGroups(); | |
| var tagsDescriptions = GetTagsDescription(); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ApplyOperationFilter : IOperationFilter | |
| { | |
| public void Apply(Operation operation, SchemaRegistry schemaRegistry, ApiDescription apiDescription) | |
| { | |
| if (operation == null) return; | |
| InitSetContentTypeJson(operation); | |
| InitSchemaOneOf(operation); | |
| InitFromUriParameters(operation, apiDescription); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| public class ApplySchemaFilter : ISchemaFilter | |
| { | |
| public void Apply(Schema schema, SchemaRegistry schemaRegistry, Type type) | |
| { | |
| if (schema?.properties == null || type == null) | |
| return; | |
| var excludedProperties = type.GetProperties() | |
| .Where(t => | |
| t.GetCustomAttribute<SwaggerExcludeAttribute>() |
NewerOlder