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

CTOOLS-300: Updated example template #35

Merged

Conversation

Matt-Storey-Finbourne
Copy link
Contributor

@Matt-Storey-Finbourne Matt-Storey-Finbourne commented Sep 20, 2024

Updated template to use an empty example instead of invalid json.

An example, example

import asyncio
from lusid.exceptions import ApiException
from lusid.models import *
from pprint import pprint
from lusid import (
    ApiClientFactory,
    TaskDefinitionsApi
)

async def main():

    with open("secrets.json", "w") as file:
        file.write('''
{
    "api":
    {
        "tokenUrl":"<your-token-url>",
        "lusidUrl":"https://<your-domain>.lusid.com/workflow",
        "username":"<your-username>",
        "password":"<your-password>",
        "clientId":"<your-client-id>",
        "clientSecret":"<your-client-secret>"
    }
}''')

    # Use the lusid ApiClientFactory to build Api instances with a configured api client
    # By default this will read config from environment variables
    # Then from a secrets.json file found in the current working directory
    api_client_factory = ApiClientFactory()

    # Enter a context with an instance of the ApiClientFactory to ensure the connection pool is closed after use
    async with api_client_factory:
        # Create an instance of the API class
        api_instance = api_client_factory.build(TaskDefinitionsApi)
        scope = 'scope_example' # str | The scope that identifies a Task Definition
        
        # Objects can be created either via the class constructor, or using the 'from_dict' or 'from_json' methods
        # Change the lines below to switch approach
        # scope = str.from_json("")
        # scope = str.from_dict("")
        scope = str()
        code = 'code_example' # str | The code that identifies a Task Definition
        
        # Objects can be created either via the class constructor, or using the 'from_dict' or 'from_json' methods
        # Change the lines below to switch approach
        # code = str.from_json("")
        # code = str.from_dict("")
        code = str()

        
        # Objects can be created either via the class constructor, or using the 'from_dict' or 'from_json' methods
        # Change the lines below to switch approach
        # update_task_definition_request = UpdateTaskDefinitionRequest.from_json("")
        # update_task_definition_request = UpdateTaskDefinitionRequest.from_dict("")
        update_task_definition_request = UpdateTaskDefinitionRequest()

        try:
            # [EXPERIMENTAL] UpdateTaskDefinition: Update an existing Task Definition
            api_response = await api_instance.update_task_definition(scope, code, update_task_definition_request)
            pprint(api_response)
        except ApiException as e:
            print("Exception when calling TaskDefinitionsApi->update_task_definition: %s\n" % e)

asyncio.run(main())

Pull Request Checklist

Description of the PR

Describe the code changes for the reviewers, explain the solution you have provided and how it fixes the issue

@Matt-Storey-Finbourne Matt-Storey-Finbourne merged commit 03a0e84 into finbourne:main Oct 1, 2024
1 check passed
@Matt-Storey-Finbourne Matt-Storey-Finbourne deleted the feature/CTOOLS-300 branch October 1, 2024 14:57
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