Skip to content

Commit

Permalink
Manage access requests programmatically (#1905)
Browse files Browse the repository at this point in the history
* first draft + docstrings

* add tests

* add AccessRequest to docs

* feedback

* document 403 error if not a write or admin role

* refacto raises sections in docstrings
  • Loading branch information
Wauplin authored Dec 15, 2023
1 parent 65b19d9 commit bf78eaa
Show file tree
Hide file tree
Showing 4 changed files with 541 additions and 0 deletions.
4 changes: 4 additions & 0 deletions docs/source/en/package_reference/hf_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,10 @@ models = hf_api.list_models()

## API Dataclasses

### AccessRequest

[[autodoc]] huggingface_hub.hf_api.AccessRequest

### CommitInfo

[[autodoc]] huggingface_hub.hf_api.CommitInfo
Expand Down
14 changes: 14 additions & 0 deletions src/huggingface_hub/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,11 @@
"RepoUrl",
"User",
"UserLikes",
"accept_access_request",
"add_collection_item",
"add_space_secret",
"add_space_variable",
"cancel_access_request",
"change_discussion_status",
"comment_discussion",
"create_branch",
Expand Down Expand Up @@ -192,14 +194,18 @@
"get_space_runtime",
"get_space_variables",
"get_token_permission",
"grant_access",
"like",
"list_accepted_access_requests",
"list_collections",
"list_datasets",
"list_files_info",
"list_inference_endpoints",
"list_liked_repos",
"list_metrics",
"list_models",
"list_pending_access_requests",
"list_rejected_access_requests",
"list_repo_commits",
"list_repo_files",
"list_repo_likers",
Expand All @@ -213,6 +219,7 @@
"pause_inference_endpoint",
"pause_space",
"preupload_lfs_files",
"reject_access_request",
"rename_discussion",
"repo_exists",
"repo_info",
Expand Down Expand Up @@ -491,9 +498,11 @@ def __dir__():
RepoUrl, # noqa: F401
User, # noqa: F401
UserLikes, # noqa: F401
accept_access_request, # noqa: F401
add_collection_item, # noqa: F401
add_space_secret, # noqa: F401
add_space_variable, # noqa: F401
cancel_access_request, # noqa: F401
change_discussion_status, # noqa: F401
comment_discussion, # noqa: F401
create_branch, # noqa: F401
Expand Down Expand Up @@ -532,14 +541,18 @@ def __dir__():
get_space_runtime, # noqa: F401
get_space_variables, # noqa: F401
get_token_permission, # noqa: F401
grant_access, # noqa: F401
like, # noqa: F401
list_accepted_access_requests, # noqa: F401
list_collections, # noqa: F401
list_datasets, # noqa: F401
list_files_info, # noqa: F401
list_inference_endpoints, # noqa: F401
list_liked_repos, # noqa: F401
list_metrics, # noqa: F401
list_models, # noqa: F401
list_pending_access_requests, # noqa: F401
list_rejected_access_requests, # noqa: F401
list_repo_commits, # noqa: F401
list_repo_files, # noqa: F401
list_repo_likers, # noqa: F401
Expand All @@ -553,6 +566,7 @@ def __dir__():
pause_inference_endpoint, # noqa: F401
pause_space, # noqa: F401
preupload_lfs_files, # noqa: F401
reject_access_request, # noqa: F401
rename_discussion, # noqa: F401
repo_exists, # noqa: F401
repo_info, # noqa: F401
Expand Down
Loading

0 comments on commit bf78eaa

Please sign in to comment.