-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e478226
commit e1a918a
Showing
19 changed files
with
92 additions
and
143 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
59 changes: 27 additions & 32 deletions
59
samples/HaveIBeenPwned.WebApi/Controllers/BreachesController.cs
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,33 +1,28 @@ | ||
// Copyright (c) David Pine. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using HaveIBeenPwned.Client; | ||
using HaveIBeenPwned.Client.Abstractions; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace HaveIBeenPwned.WebApi.Controllers; | ||
|
||
[ApiController] | ||
[Route("api/breaches")] | ||
public class BreachesController(IPwnedBreachesClient pwnedBreachesClient) : ControllerBase | ||
// Copyright (c) David Pine. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
using HaveIBeenPwned.Client; | ||
using HaveIBeenPwned.Client.Abstractions; | ||
using Microsoft.AspNetCore.Mvc; | ||
|
||
namespace HaveIBeenPwned.WebApi.Controllers; | ||
|
||
[ApiController] | ||
[Route("api/breaches")] | ||
public class BreachesController(IPwnedBreachesClient pwnedBreachesClient) : ControllerBase | ||
{ | ||
[HttpGet, Route("{breachName}")] | ||
public Task<BreachDetails?> GetBreach([FromRoute] string breachName) => | ||
pwnedBreachesClient.GetBreachAsync(breachName); | ||
|
||
[HttpGet, Route("headers/{domain}")] | ||
public Task<BreachHeader[]> GetBreaches([FromRoute] string? domain) => | ||
pwnedBreachesClient.GetBreachesAsync(domain); | ||
|
||
[HttpGet, Route("{account}/breaches")] | ||
public Task<BreachDetails[]> GetBreachesForAccount([FromRoute] string account) => | ||
pwnedBreachesClient.GetBreachesForAccountAsync(account); | ||
|
||
[HttpGet, Route("{account}/headers")] | ||
public Task<BreachHeader[]> GetBreachHeadersForAccount([FromRoute] string account) => | ||
pwnedBreachesClient.GetBreachHeadersForAccountAsync(account); | ||
|
||
[HttpGet, Route("dataclasses")] | ||
public Task<string[]> GetDataClasses() => | ||
pwnedBreachesClient.GetDataClassesAsync(); | ||
} | ||
[HttpGet, Route("{breachName}")] | ||
public Task<BreachDetails?> GetBreach([FromRoute] string breachName) => pwnedBreachesClient.GetBreachAsync(breachName); | ||
|
||
[HttpGet, Route("headers/{domain}")] | ||
public Task<BreachHeader[]> GetBreaches([FromRoute] string? domain) => pwnedBreachesClient.GetBreachesAsync(domain); | ||
|
||
[HttpGet, Route("{account}/breaches")] | ||
public Task<BreachDetails[]> GetBreachesForAccount([FromRoute] string account) => pwnedBreachesClient.GetBreachesForAccountAsync(account); | ||
|
||
[HttpGet, Route("{account}/headers")] | ||
public Task<BreachHeader[]> GetBreachHeadersForAccount([FromRoute] string account) => pwnedBreachesClient.GetBreachHeadersForAccountAsync(account); | ||
|
||
[HttpGet, Route("dataclasses")] | ||
public Task<string[]> GetDataClasses() => pwnedBreachesClient.GetDataClassesAsync(); | ||
} |
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,6 @@ | ||
// Copyright (c) David Pine. All rights reserved. | ||
// Licensed under the MIT License. | ||
|
||
global using Xunit; | ||
|
||
global using HaveIBeenPwned.Client.Extensions; | ||
global using HaveIBeenPwned.Client.Options; | ||
global using HaveIBeenPwned.Client.Options; | ||
global using Xunit; |
This file contains 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
This file contains 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
Oops, something went wrong.