|
| 1 | +"""Type definitions for search index results.""" |
| 2 | + |
| 3 | +from __future__ import annotations |
| 4 | + |
| 5 | +from typing import TypedDict |
| 6 | + |
| 7 | + |
| 8 | +class UserSearchHit(TypedDict, total=False): |
| 9 | + """GitHub user search hit.""" |
| 10 | + |
| 11 | + idx_bio: str | None |
| 12 | + idx_company: str | None |
| 13 | + idx_followers_count: int |
| 14 | + idx_following_count: int |
| 15 | + idx_location: str | None |
| 16 | + idx_login: str |
| 17 | + idx_name: str | None |
| 18 | + idx_public_repositories_count: int |
| 19 | + idx_url: str |
| 20 | + |
| 21 | + |
| 22 | +class ChapterSearchHit(TypedDict, total=False): |
| 23 | + """OWASP chapter search hit.""" |
| 24 | + |
| 25 | + idx_country: str |
| 26 | + idx_key: str |
| 27 | + idx_leaders: list[str] |
| 28 | + idx_name: str |
| 29 | + idx_suggested_location: str | None |
| 30 | + idx_summary: str |
| 31 | + idx_url: str |
| 32 | + |
| 33 | + |
| 34 | +class CommitteeSearchHit(TypedDict, total=False): |
| 35 | + """OWASP committee search hit.""" |
| 36 | + |
| 37 | + idx_leaders: list[str] |
| 38 | + idx_name: str |
| 39 | + idx_summary: str |
| 40 | + idx_url: str |
| 41 | + |
| 42 | + |
| 43 | +class IssueSearchHit(TypedDict, total=False): |
| 44 | + """GitHub issue search hit.""" |
| 45 | + |
| 46 | + idx_project_name: str |
| 47 | + idx_project_url: str |
| 48 | + idx_summary: str |
| 49 | + idx_title: str |
| 50 | + idx_url: str |
| 51 | + |
| 52 | + |
| 53 | +class ProjectSearchHit(TypedDict, total=False): |
| 54 | + """OWASP project search hit.""" |
| 55 | + |
| 56 | + idx_contributors_count: int |
| 57 | + idx_forks_count: int |
| 58 | + idx_key: str |
| 59 | + idx_leaders: list[str] |
| 60 | + idx_name: str |
| 61 | + idx_stars_count: int |
| 62 | + idx_summary: str |
| 63 | + idx_updated_at: int |
| 64 | + idx_url: str |
| 65 | + |
| 66 | + |
| 67 | +class UserSearchResult(TypedDict): |
| 68 | + """Result returned by a GitHub user search.""" |
| 69 | + |
| 70 | + hits: list[UserSearchHit] |
| 71 | + nbPages: int |
| 72 | + |
| 73 | + |
| 74 | +class ChapterSearchResult(TypedDict): |
| 75 | + """Result returned by an OWASP chapter search.""" |
| 76 | + |
| 77 | + hits: list[ChapterSearchHit] |
| 78 | + nbPages: int |
| 79 | + |
| 80 | + |
| 81 | +class CommitteeSearchResult(TypedDict): |
| 82 | + """Result returned by an OWASP committee search.""" |
| 83 | + |
| 84 | + hits: list[CommitteeSearchHit] |
| 85 | + nbPages: int |
| 86 | + |
| 87 | + |
| 88 | +class IssueSearchResult(TypedDict): |
| 89 | + """Result returned by a GitHub issue search.""" |
| 90 | + |
| 91 | + hits: list[IssueSearchHit] |
| 92 | + nbPages: int |
| 93 | + |
| 94 | + |
| 95 | +class ProjectSearchResult(TypedDict): |
| 96 | + """Result returned by an OWASP project search.""" |
| 97 | + |
| 98 | + hits: list[ProjectSearchHit] |
| 99 | + nbPages: int |
0 commit comments