The Sheriff Application¶
This part of the documentation covers all interfaces on thesheriff.application module.
Gang¶
-
class
thesheriff.application.gang.list_gangs.
ListGangs
(gang_repository: thesheriff.domain.gang.repository.gang_repository.GangRepository)¶ Class ListGangs implements the list all gangs use case.
- Parameters
gang_repository (GangRepository) – Repository managing Gang domain entities.
-
class
thesheriff.application.gang.request.create_gang_request.
CreateGangRequest
(owner_id: int, name: str)¶ Class JoinGangRequest holds data required to join a Gang.
- Parameters
name (String) – Name of the Gang.
owner_id (Integer) – Id of the Outlaw creating the gang.
-
class
thesheriff.application.gang.request.join_gang_request.
JoinGangRequest
(gang_id: int, outlaw_id: int)¶ Class JoinGangRequest holds data required to join a Gang.
- Parameters
gang_id (Integer) – Id of the Gang.
outlaw_id (Integer) – Id of the Outlaw generating the request.
Outlaw¶
-
class
thesheriff.application.outlaw.create_gang.
CreateGang
(gang_repository: thesheriff.domain.gang.repository.gang_repository.GangRepository)¶ Class CreateGang implements the gang creation use case.
- Parameters
gang_repository (GangRepository) – Repository managing Gang domain entities.
-
execute
(request: thesheriff.application.gang.request.create_gang_request.CreateGangRequest) → thesheriff.domain.gang.gang.Gang¶ execute is the actual action of the Create Gang use case.
- Parameters
request (CreateGangRequest) – Request object holding the Gang details.
- Returns
The created Gang.
- Return type
-
class
thesheriff.application.outlaw.create_outlaw.
CreateOutlaw
(outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository)¶ Class CreateOutlaw implements the Outlaw creation use case.
- Parameters
outlaw_repository (OutlawRepository) – Repository managing Outlaw domain entities.
-
execute
(request: thesheriff.application.outlaw.request.create_outlaw_request.CreateOutlawRequest) → thesheriff.domain.outlaw.outlaw.Outlaw¶ execute is the actual action of the Create Outlaw use case.
- Parameters
request (CreateOutlawRequest) – Request holding the new Outlaw details.
- Returns
The newly created Outlaw.
- Return type
-
class
thesheriff.application.outlaw.invite_friend.
InviteFriend
(outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository, mail_notifier: thesheriff.domain.mail.notifier.mail_notifier.MailNotifier)¶ Class InviteFriend implements the invite a friend use case.
- Parameters
outlaw_repository (OutLawRepository) – Associated repo to retrieve outlaw by his id.
mail_notifier (MailNotifier) – Notifier object to handle email notifications.
-
execute
(request: thesheriff.application.outlaw.request.invite_friend_request.InviteFriendRequest) → thesheriff.domain.mail.mail.Mail¶ execute is the actual action of the Invite Friend use case.
- Parameters
request (InviteFriendRequest) – The address to write on the TO field.
- Return mail
Mail.
- Return type
-
class
thesheriff.application.outlaw.join_gang.
JoinGang
(outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository, gang_repository: thesheriff.domain.gang.repository.gang_repository.GangRepository)¶ JoinGang class implements the Join Gang use case.
- Parameters
outlaw_repository (OutlawRepository) – Repository for managing Outlaw entities.
gang_repository (GangRepository) – Repository for managing Gang entities.
-
execute
(request: thesheriff.application.gang.request.join_gang_request.JoinGangRequest) → NoReturn¶ execute is the actual action of the Join Gang use case.
- Parameters
request (JoinGangRequest) – Request holding details for joining a Gang.
- Returns
No value returned.
- Return type
NoReturn
-
class
thesheriff.application.outlaw.list_friends.
ListFriends
(outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository)¶ Class ListFriends implements the List Outlaw’s Friends use case.
- Parameters
outlaw_repository (OutlawRepository) – Repository managing Outlaw domain entities.
-
execute
(request: thesheriff.application.outlaw.request.list_friends_request.ListFriendsRequest) → List[thesheriff.domain.outlaw.outlaw.Outlaw]¶ execute is the actual action of the List Outlaw’s Friends use case.
- Parameters
request (ListFriendsRequest) – object holding the data to retrieve outlaw’s friends.
- Returns
The list of friends.
- Return type
List[Outlaw]
-
class
thesheriff.application.outlaw.list_gangs.
ListGangs
(gang_repository: thesheriff.domain.gang.repository.gang_repository.GangRepository)¶ Class ListGangs implements the List Outlaw’s Gangs use case.
- Parameters
gang_repository (GangRepository) – Repository managing the Gang domain entities.
-
execute
(request: thesheriff.application.outlaw.request.list_gangs_request.ListGangsRequest) → List[thesheriff.domain.gang.gang.Gang]¶ execute is the actual action of the List Gangs use case.
- Parameters
request (ListGangsRequest) – request object holding data to perform the action.
- Returns
The list of gangs.
- Return type
List[Gang]
-
class
thesheriff.application.outlaw.rate_raid.
RateRaid
(outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository, raid_repository: thesheriff.domain.raid.repository.raid_repository.RaidRepository)¶ Class RateRaid implements the Raid rating use case.
- Parameters
outlaw_repository (OutlawRepository) – Repository managing Outlaw domain entities.
raid_repository (RaidRepository) – Repository managing Raid domain entities.
-
execute
(request: thesheriff.application.raid.request.rate_raid_request.RateRaidRequest) → NoReturn¶ execute is the actual action of the Raid rating use case.
- Parameters
request (RateRaidRequest) – the RateRaidRequest holding all the data
- Returns
No value returned.
- Return type
NoReturn
-
class
thesheriff.application.outlaw.request.create_outlaw_request.
CreateOutlawRequest
(name: str, email: str)¶ Class CreateOutlawRequest holds data required to create an Outlaw.
- Parameters
name (String) – Outlaw’s given name.
email (String) – Outlaw’s email.
-
class
thesheriff.application.outlaw.request.invite_friend_request.
InviteFriendRequest
(outlaw_id: int, mail_address_receiver: str)¶ Class InviteFriendRequest holds data required to invite an Outlaw’s friend.
- Parameters
outlaw_id (int) – Outlaw’s id.
mail_address_receiver (str) – friend’s email
-
class
thesheriff.application.outlaw.request.list_friends_request.
ListFriendsRequest
(outlaw_id: int)¶ Class ListFriendsRequest holds data required to get Outlaw’s friends.
- Parameters
outlaw_id (int) – Outlaw’s id.
-
class
thesheriff.application.outlaw.request.list_gangs_request.
ListGangsRequest
(outlaw_id: int)¶ Class ListGangsRequest holds data required to get Outlaw’s gangs.
- Parameters
outlaw_id (int) – Outlaw’s id.
Raid¶
-
class
thesheriff.application.raid.create_raid.
CreateRaid
(outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository, gang_repository: thesheriff.domain.gang.repository.gang_repository.GangRepository, raid_repository: thesheriff.domain.raid.repository.raid_repository.RaidRepository)¶ Class CreateRaid implements the Create Raid use case.
- Parameters
outlaw_repository (OutlawRepository) – Repository managing Outlaw domain entities.
gang_repository (GangRepository) – Repository managing Gang domain entities.
raid_repository (RaidRepository) – Repository managing Raid domain entities.
-
execute
(request: thesheriff.application.raid.request.create_raid_request.CreateRaidRequest) → thesheriff.domain.raid.raid.Raid¶ execute is the actual action of Create a Raid use case.
- Parameters
request (CreateRaidRequest) – Request object with details for creating a Raid.
- Returns
The created Raid.
- Return type
-
class
thesheriff.application.raid.end_raid.
EndRaid
(mail_notifier: thesheriff.domain.mail.notifier.mail_notifier.MailNotifier, raid_repository: thesheriff.domain.raid.repository.raid_repository.RaidRepository, outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository)¶ Class EndRaid implements the End a Raid use case.
- Parameters
raid_repository (RaidRepository) – Repository managing Raid domain entities.
-
execute
(request: thesheriff.application.raid.request.end_raid_request.EndRaidRequest)¶ execute is the actual action of the End a Raid use case.
- Parameters
request (EndRaidRequest) – Request holding the Raid details to be ended.
- Returns
Message with scores.
- Return type
String
-
class
thesheriff.application.raid.grade_raid.
GradeRaid
(raid_repository: thesheriff.domain.raid.repository.raid_repository.RaidRepository, outlaw_repository: thesheriff.domain.outlaw.repository.outlaw_repository.OutlawRepository)¶ Class GradeRaid implements the Grade Raids use case.
- Parameters
outlaw_repository (OutlawRepository) – Repository managing Outlaw domain entities.
-
execute
(request: thesheriff.application.raid.request.grade_raid_request.GradeRaidRequest) → float¶ execute is the actual action of the Grade a Raid use case.
- Parameters
request (a GradeRaidRequest) – Id of Raid entity to be graded.
- Returns
The raid grade.
- Return type
Float
-
class
thesheriff.application.raid.request.create_raid_request.
CreateRaidRequest
(name: str, date: str, location: str, gang_id: int, sheriff_id: int, outlaw_ids: List[int])¶ Class CreateRaidRequest holds data required to create a Raid.
- Parameters
name (String) – Raid’s given name.
date (String) – Date and time for the Raid.
location (String) – Location of the Raid.
gang_id (Integer) – Id of the Gang where the Raid is being organized.
sheriff_id (Integer) – Id of the Sheriff organizing the Raid.
outlaw_ids (List[Integer]) – List of Outlaw Ids invited to the Raid.
-
class
thesheriff.application.raid.request.end_raid_request.
EndRaidRequest
(raid_id: int, raid_score: float)¶ Class EndRaidRequest holds data required to end a Raid.
- Parameters
raid_id (Integer) – Id of the Raid to be ended.
raid_score (Float) – Score assigned to the Raid.
-
class
thesheriff.application.raid.request.grade_raid_request.
GradeRaidRequest
(raid_id: int)¶ Class GradeRaidRequest holds data required to grade a Raid.
- Parameters
raid_id (Integer) – Id of the Raid to be ended.
-
class
thesheriff.application.raid.request.rate_raid_request.
RateRaidRequest
(raid_id: int, outlaw_id: int, score: thesheriff.domain.outlaw.score.Score)¶ Class RateRaidRequest holds data required to rate a Raid.
- Parameters
raid_id (Integer) – Id of the Raid to be ended.
outlaw_id (Integer) – Id of the Outlaw performing the rate.
score (Score) – the Outlaw’s score rating.