Skip to content

Commit

Permalink
Documentation Repository
Browse files Browse the repository at this point in the history
  • Loading branch information
dyohan9 committed Aug 19, 2019
1 parent a360b55 commit 98e908d
Showing 1 changed file with 67 additions and 8 deletions.
75 changes: 67 additions & 8 deletions bothub/api/v2/repository/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,20 @@ class RepositoryViewSet(
GenericViewSet):
"""
Manager repository (bot).
create:
Create a new Repository, add examples and train a bot.
retrieve:
Get repository data.
update:
Update your repository.
partial_update:
Update, partially, your repository.
delete:
Delete your repository.
"""
queryset = Repository.objects
lookup_field = 'uuid'
Expand Down Expand Up @@ -208,6 +222,16 @@ class RepositoryVotesViewSet(
GenericViewSet):
"""
Manager repository votes (bot).
create:
Add vote in repository
destroy:
Remove vote in repository
list:
List all votes in repository
"""
queryset = RepositoryVote.objects.all()
lookup_field = 'repository'
Expand Down Expand Up @@ -252,7 +276,8 @@ class RepositoriesViewSet(
mixins.ListModelMixin,
GenericViewSet):
"""
List all public repositories.
list:
List all public repositories.
"""
serializer_class = ShortRepositorySerializer
queryset = Repository.objects.all().publics().order_by_relevance()
Expand Down Expand Up @@ -286,7 +311,8 @@ class RepositoriesContributionsViewSet(
mixins.ListModelMixin,
GenericViewSet):
"""
List Repositories Contributions by user.
list:
List Repositories Contributions by user.
"""
serializer_class = RepositoryContributionsSerializer
queryset = RepositoryAuthorization.objects.all()
Expand All @@ -311,7 +337,8 @@ class RepositoryCategoriesView(
mixins.ListModelMixin,
GenericViewSet):
"""
List all categories.
list:
List all categories.
"""
serializer_class = RepositoryCategorySerializer
queryset = RepositoryCategory.objects.all()
Expand All @@ -335,7 +362,8 @@ class SearchRepositoriesViewSet(
mixins.ListModelMixin,
GenericViewSet):
"""
List all user's repositories
list:
Search and List all user's repositories
"""
queryset = Repository.objects
serializer_class = RepositorySerializer
Expand All @@ -361,6 +389,15 @@ class RepositoryAuthorizationViewSet(
mixins.UpdateModelMixin,
mixins.ListModelMixin,
GenericViewSet):
"""
list:
List all Authorizations
update:
Update Authorization
partial_update:
Update Authorization
"""
queryset = RepositoryAuthorization.objects.exclude(
role=RepositoryAuthorization.ROLE_NOT_SETTED)
serializer_class = RepositoryAuthorizationSerializer
Expand Down Expand Up @@ -409,7 +446,20 @@ class RepositoryAuthorizationRequestsViewSet(
mixins.DestroyModelMixin,
GenericViewSet):
"""
List of all authorization requests for a repository
list:
List of all authorization requests for a repository
create:
Request authorization in the repository
update:
Update the user who requested authorization from a repository
partial_update:
Update the user who requested authorization from a repository
destroy:
Removes the user who requested authorization from a repository
"""
queryset = RequestRepositoryAuthorization.objects.exclude(
approved_by__isnull=False)
Expand Down Expand Up @@ -455,14 +505,17 @@ class RepositoryExampleViewSet(
"""
Manager repository example.
create:
Create repository example data.
retrieve:
Get repository example data.
Get repository example data.
delete:
Delete repository example.
Delete repository example.
update:
Update repository example.
Update repository example.
"""
queryset = RepositoryExample.objects
Expand All @@ -484,6 +537,12 @@ def perform_destroy(self, obj):
class RepositoryUpdatesViewSet(
mixins.ListModelMixin,
GenericViewSet):

"""
list:
List all trainings repository
"""

queryset = RepositoryUpdate.objects.filter(
training_started_at__isnull=False).order_by('-trained_at')
serializer_class = RepositoryUpdateSerializer
Expand Down

0 comments on commit 98e908d

Please sign in to comment.