Open
Conversation
939199e to
7a26391
Compare
Adds a resource server API similar to the one that already exists for Drive.
7a26391 to
a4dfd39
Compare
lunika
reviewed
Mar 6, 2026
Comment on lines
+71
to
+95
| def create_document_from_markdown(self, request): | ||
| """ | ||
| Create a new document from a Markdown file at root level. | ||
| """ | ||
|
|
||
| # Get the access token from the session | ||
| access_token = request.session.get('oidc_access_token') | ||
|
|
||
| # Create a new document from a file | ||
| file_content = b"# Test Document\n\nThis is a test." | ||
| file = BytesIO(file_content) | ||
| file.name = "readme.md" | ||
|
|
||
| response = requests.post( | ||
| f"{settings.DOCS_API}/documents/", | ||
| { | ||
| "file": file, | ||
| }, | ||
| format="multipart", | ||
| ) | ||
|
|
||
| response.raise_for_status() | ||
| data = response.json() | ||
| return {"id": data["id"]} | ||
| ``` |
Member
There was a problem hiding this comment.
This example does not work for Docs, only for Drive.
|
|
||
| # Check if the user is authenticated | ||
| if not request.user.is_authenticated: | ||
| return False |
Member
There was a problem hiding this comment.
Suggested change
| return False | |
| return False | |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Purpose
Adds a resource server API similar to the one that already exists for Drive.
Proposal
resource_serverAPI with four endpoints :documents,document_accesses,document_invitation,users, along with unit tests that check that :docs/resource_server.md.List of actions for each endpoint
For documents:
For document accesses:
For invitations:
For users: