Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add API V2 support #97

Open
wants to merge 8 commits into
base: master
Choose a base branch
from
Open

Add API V2 support #97

wants to merge 8 commits into from

Conversation

stuartdietrich
Copy link
Collaborator

Pull Request Summary

Description

Please include a summary of the changes. Please also include the relevant context and motivation. List any dependencies and assumptions that are required for this change.

Added client for V2 endpoints and utility function v2_get_tasks. Updated requirements and python version to >=3.8 to support the new client.

How did you test your code?

Which of the following have you done to test your changes? Please describe the tests that you ran to verify your changes.

  • Created new unit tests in tests/ for the newly implemented methods
  • Updated existing unit tests in tests/ to cover changes made to existing methods

Added tests for v2_get_tasks and v2.get_task - leaving commented until they can pass for other users.

Checklist

Please make sure all items in this checklist have been fulfilled before sending your PR out for review!

  • I have commented my code in details, particularly in hard-to-understand areas
  • I have updated Readme.rst document with examples for newly implemented public methods
  • I have reviewed Deployment and Publishing Guide for Python SDK document
  • I incremented the SDK version in _version.py (unless this PR only updates the documentation).
  • In order to release a new version, a "Release Summary" needs to be prepared and published after the merge

@@ -17,11 +17,11 @@ jobs:
- run:
name: Black Formatting Check # Only validation, without re-formatting
command: |
black --check -t py36 .
black --check --exclude 'scaleapi/api_client/*' -t py38 .
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is there a way to run it through black after we generate. We run the typescript one through prettier

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a big deal if it's not easy

$ openapi-generator-cli generate --auth "Authorization:$SCALE_API_AUTH_HEADER" --config v2_generator.json
```

Additionally, update the Annotation model type discrimination if there are changes
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add a link to where the line that needs to be updated as an example?

@@ -318,6 +330,83 @@ def tasks(self, **kwargs) -> Tasklist:
response.get("next_token"),
)

def v2_get_tasks(
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so you can do like:

client = ScaleClient()
client.v2_get_tasks(...)
client.v2.get_tasks(...)

right?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants