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
| sendMessage = async (message) => { | |
| let fromUserId = this.props.user.userId; | |
| let toUserIds = this.props.parties?.filter(p => p !== fromUserId); | |
| let chatGroupId = isEmpty(this.props.chatGroupId) ? this.state.chatGroupId : this.props.chatGroupId; | |
| const data = { | |
| message: message, | |
| context: this.props.context, | |
| chatGroupId: chatGroupId, | |
| fromUserId: fromUserId, |
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
| initiateChatRoomSetup = async () => { | |
| const connection = new HubConnectionBuilder() | |
| .withUrl( | |
| `${'backend-api/hubs/chat'}`, | |
| { | |
| accessTokenFactory: () => this.props.accessToken, | |
| UseDefaultCredentials: true | |
| } | |
| ) | |
| .configureLogging(LogLevel.Trace) |
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
| app.UseEndpoints(endpoints => | |
| { | |
| endpoints.MapHub<ChatHub>("/hubs/chat"); | |
| endpoints.MapControllerRoute( | |
| name: "default", | |
| pattern: "{controller=Home}/{action=Index}/{id?}"); | |
| }); |
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
| <Chat | |
| parties={this.state.chatParticipantIds} | |
| context={General.ChatContext.DirectMessages} | |
| chatGroupId={this.state.chatGroupId} | |
| /> |
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
| [Authorize] | |
| public class ChatHub : Hub | |
| { | |
| private readonly IChatService chatService; | |
| public ChatHub(IChatService chatService) | |
| { | |
| this.chatService = chatService; | |
| } |
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
| curl --location 'https://api.pellerex.com/proxy/35af8351-......7cf77c6a9615/v1/hello' \ | |
| --header 'Authorization: Bearer eyJhbGciOiJo......ru3_I1YIPCCYw5wCF9ty2nhF4_XD9S0' \ | |
| --header 'Content-Type: application/json' \ | |
| --data-raw '{ | |
| "context": "Jim is walking through the woods.", | |
| "question": "Where is he walking?" | |
| }' |
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
| curl --location --request POST 'https://api.pellerex.com/identity/v2/account/login' \ | |
| --header 'Content-Type: application/json' \ | |
| --header 'Authorization: Basic amFtZX.....jMTIz' \ | |
| --data-raw '{}' |
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
| curl --location --request POST 'https://api.pellerex.com/identity/v1/account/refresh-token' \ | |
| --header 'Content-Type: application/json' \ | |
| --data-raw '{ | |
| "AccessToken": "eyJhbGciOiJodHRw....C7HuVE-wWsxQ", | |
| "RefreshToken": "CfDJ8MNEJ5U....pjjlcYcmn4uLQIxwukFQ==" | |
| }' |
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("product")] | |
| [MapToApiVersion("1")] | |
| [ResponseCache(VaryByQueryKeys = new[] { "field", "category" }, Duration = 10 * 60)] | |
| public async Task<ActionResult<IEnumerable<ProductViewModel>>> GetProducts( | |
| [FromQuery] string field, | |
| [FromQuery] string category) | |
| { | |
| return Ok(response); | |
| } |
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 void ConfigureServices(IServiceCollection services) | |
| { | |
| services.AddResponseCompression(options => | |
| { | |
| options.Providers.Add<BrotliCompressionProvider>(); | |
| options.Providers.Add<GzipCompressionProvider>(); | |
| }); | |
| services.AddResponseCaching(); | |
| } |