Skip to content

Latest commit

 

History

History
403 lines (298 loc) · 16.5 KB

BlocksApi.md

File metadata and controls

403 lines (298 loc) · 16.5 KB

lusid.BlocksApi

All URIs are relative to https://www.lusid.com/api

Method HTTP request Description
delete_block DELETE /api/blocks/{scope}/{code} [EARLY ACCESS] DeleteBlock: Delete block
get_block GET /api/blocks/{scope}/{code} [EARLY ACCESS] GetBlock: Get Block
list_blocks GET /api/blocks [EARLY ACCESS] ListBlocks: List Blocks
upsert_blocks POST /api/blocks [EARLY ACCESS] UpsertBlocks: Upsert Block

delete_block

DeletedEntityResponse delete_block(scope, code)

[EARLY ACCESS] DeleteBlock: Delete block

Delete an block. Deletion will be valid from the block's creation datetime. This means that the block will no longer exist at any effective datetime from the asAt datetime of deletion.

Example

from lusid.exceptions import ApiException
from lusid.extensions.configuration_options import ConfigurationOptions
from lusid.models import *
from pprint import pprint
from lusid import (
    SyncApiClientFactory,
    BlocksApi
)

def main():

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

    # Use the lusid SyncApiClientFactory 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

    # uncomment the below to use configuration overrides
    # opts = ConfigurationOptions();
    # opts.total_timeout_ms = 30_000

    # uncomment the below to use an api client factory with overrides
    # api_client_factory = SyncApiClientFactory(opts=opts)

    api_client_factory = SyncApiClientFactory()

    # Enter a context with an instance of the SyncApiClientFactory to ensure the connection pool is closed after use
    
    # Create an instance of the API class
    api_instance = api_client_factory.build(BlocksApi)
    scope = 'scope_example' # str | The block scope.
    code = 'code_example' # str | The block's code. This, together with the scope uniquely identifies the block to delete.

    try:
        # uncomment the below to set overrides at the request level
        # api_response =  api_instance.delete_block(scope, code, opts=opts)

        # [EARLY ACCESS] DeleteBlock: Delete block
        api_response = api_instance.delete_block(scope, code)
        pprint(api_response)

    except ApiException as e:
        print("Exception when calling BlocksApi->delete_block: %s\n" % e)

main()

Parameters

Name Type Description Notes
scope str The block scope.
code str The block's code. This, together with the scope uniquely identifies the block to delete.

Return type

DeletedEntityResponse

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
200 The response from deleting an block. -
400 The details of the input related failure -
0 Error response -

Back to topBack to API listBack to Model listBack to README

get_block

Block get_block(scope, code, as_at=as_at, property_keys=property_keys)

[EARLY ACCESS] GetBlock: Get Block

Fetch a Block that matches the specified identifier

Example

from lusid.exceptions import ApiException
from lusid.extensions.configuration_options import ConfigurationOptions
from lusid.models import *
from pprint import pprint
from lusid import (
    SyncApiClientFactory,
    BlocksApi
)

def main():

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

    # Use the lusid SyncApiClientFactory 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

    # uncomment the below to use configuration overrides
    # opts = ConfigurationOptions();
    # opts.total_timeout_ms = 30_000

    # uncomment the below to use an api client factory with overrides
    # api_client_factory = SyncApiClientFactory(opts=opts)

    api_client_factory = SyncApiClientFactory()

    # Enter a context with an instance of the SyncApiClientFactory to ensure the connection pool is closed after use
    
    # Create an instance of the API class
    api_instance = api_client_factory.build(BlocksApi)
    scope = 'scope_example' # str | The scope to which the block belongs.
    code = 'code_example' # str | The block's unique identifier.
    as_at = '2013-10-20T19:20:30+01:00' # datetime | The asAt datetime at which to retrieve the block. Defaults to return the latest version of the block if not specified. (optional)
    property_keys = ['property_keys_example'] # List[str] | A list of property keys from the \"Block\" domain to decorate onto the block.              These take the format {domain}/{scope}/{code} e.g. \"Block/system/Name\". (optional)

    try:
        # uncomment the below to set overrides at the request level
        # api_response =  api_instance.get_block(scope, code, as_at=as_at, property_keys=property_keys, opts=opts)

        # [EARLY ACCESS] GetBlock: Get Block
        api_response = api_instance.get_block(scope, code, as_at=as_at, property_keys=property_keys)
        pprint(api_response)

    except ApiException as e:
        print("Exception when calling BlocksApi->get_block: %s\n" % e)

main()

Parameters

Name Type Description Notes
scope str The scope to which the block belongs.
code str The block's unique identifier.
as_at datetime The asAt datetime at which to retrieve the block. Defaults to return the latest version of the block if not specified. [optional]
property_keys List[str] A list of property keys from the &quot;Block&quot; domain to decorate onto the block. These take the format {domain}/{scope}/{code} e.g. &quot;Block/system/Name&quot;. [optional]

Return type

Block

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
200 The block matching the given identifier. -
400 The details of the input related failure -
0 Error response -

Back to topBack to API listBack to Model listBack to README

list_blocks

PagedResourceListOfBlock list_blocks(as_at=as_at, page=page, sort_by=sort_by, limit=limit, filter=filter, property_keys=property_keys)

[EARLY ACCESS] ListBlocks: List Blocks

Fetch the last pre-AsAt date version of each block in scope (does not fetch the entire history).

Example

from lusid.exceptions import ApiException
from lusid.extensions.configuration_options import ConfigurationOptions
from lusid.models import *
from pprint import pprint
from lusid import (
    SyncApiClientFactory,
    BlocksApi
)

def main():

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

    # Use the lusid SyncApiClientFactory 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

    # uncomment the below to use configuration overrides
    # opts = ConfigurationOptions();
    # opts.total_timeout_ms = 30_000

    # uncomment the below to use an api client factory with overrides
    # api_client_factory = SyncApiClientFactory(opts=opts)

    api_client_factory = SyncApiClientFactory()

    # Enter a context with an instance of the SyncApiClientFactory to ensure the connection pool is closed after use
    
    # Create an instance of the API class
    api_instance = api_client_factory.build(BlocksApi)
    as_at = '2013-10-20T19:20:30+01:00' # datetime | The asAt datetime at which to retrieve the block. Defaults to return the latest version of the block if not specified. (optional)
    page = 'page_example' # str | The pagination token to use to continue listing blocks from a previous call to list blocks.              This value is returned from the previous call. If a pagination token is provided the sortBy, filter, effectiveAt, and asAt fields              must not have changed since the original request. (optional)
    sort_by = ['sort_by_example'] # List[str] | A list of field names or properties to sort by, each suffixed by \" ASC\" or \" DESC\". (optional)
    limit = 56 # int | When paginating, limit the number of returned results to this many. (optional)
    filter = 'filter_example' # str | Expression to filter the result set. Read more about filtering results from LUSID here:              https://support.lusid.com/filtering-results-from-lusid. (optional)
    property_keys = ['property_keys_example'] # List[str] | A list of property keys from the \"Block\" domain to decorate onto each block.                  These take the format {domain}/{scope}/{code} e.g. \"Block/system/Name\".                  All properties, except derived properties, are returned by default, without specifying here. (optional)

    try:
        # uncomment the below to set overrides at the request level
        # api_response =  api_instance.list_blocks(as_at=as_at, page=page, sort_by=sort_by, limit=limit, filter=filter, property_keys=property_keys, opts=opts)

        # [EARLY ACCESS] ListBlocks: List Blocks
        api_response = api_instance.list_blocks(as_at=as_at, page=page, sort_by=sort_by, limit=limit, filter=filter, property_keys=property_keys)
        pprint(api_response)

    except ApiException as e:
        print("Exception when calling BlocksApi->list_blocks: %s\n" % e)

main()

Parameters

Name Type Description Notes
as_at datetime The asAt datetime at which to retrieve the block. Defaults to return the latest version of the block if not specified. [optional]
page str The pagination token to use to continue listing blocks from a previous call to list blocks. This value is returned from the previous call. If a pagination token is provided the sortBy, filter, effectiveAt, and asAt fields must not have changed since the original request. [optional]
sort_by List[str] A list of field names or properties to sort by, each suffixed by &quot; ASC&quot; or &quot; DESC&quot;. [optional]
limit int When paginating, limit the number of returned results to this many. [optional]
filter str Expression to filter the result set. Read more about filtering results from LUSID here: https://support.lusid.com/filtering-results-from-lusid. [optional]
property_keys List[str] A list of property keys from the &quot;Block&quot; domain to decorate onto each block. These take the format {domain}/{scope}/{code} e.g. &quot;Block/system/Name&quot;. All properties, except derived properties, are returned by default, without specifying here. [optional]

Return type

PagedResourceListOfBlock

HTTP request headers

  • Content-Type: Not defined
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
200 Blocks in scope. -
400 The details of the input related failure -
0 Error response -

Back to topBack to API listBack to Model listBack to README

upsert_blocks

ResourceListOfBlock upsert_blocks(block_set_request=block_set_request)

[EARLY ACCESS] UpsertBlocks: Upsert Block

Upsert; update existing blocks with given ids, or create new blocks otherwise.

Example

from lusid.exceptions import ApiException
from lusid.extensions.configuration_options import ConfigurationOptions
from lusid.models import *
from pprint import pprint
from lusid import (
    SyncApiClientFactory,
    BlocksApi
)

def main():

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

    # Use the lusid SyncApiClientFactory 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

    # uncomment the below to use configuration overrides
    # opts = ConfigurationOptions();
    # opts.total_timeout_ms = 30_000

    # uncomment the below to use an api client factory with overrides
    # api_client_factory = SyncApiClientFactory(opts=opts)

    api_client_factory = SyncApiClientFactory()

    # Enter a context with an instance of the SyncApiClientFactory to ensure the connection pool is closed after use
    
    # Create an instance of the API class
    api_instance = api_client_factory.build(BlocksApi)

    # 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
    # block_set_request = BlockSetRequest.from_json("")
    # block_set_request = BlockSetRequest.from_dict({})
    block_set_request = BlockSetRequest()

    try:
        # uncomment the below to set overrides at the request level
        # api_response =  api_instance.upsert_blocks(block_set_request=block_set_request, opts=opts)

        # [EARLY ACCESS] UpsertBlocks: Upsert Block
        api_response = api_instance.upsert_blocks(block_set_request=block_set_request)
        pprint(api_response)

    except ApiException as e:
        print("Exception when calling BlocksApi->upsert_blocks: %s\n" % e)

main()

Parameters

Name Type Description Notes
block_set_request BlockSetRequest The collection of block requests. [optional]

Return type

ResourceListOfBlock

HTTP request headers

  • Content-Type: application/json-patch+json, application/json, text/json, application/*+json
  • Accept: text/plain, application/json, text/json

HTTP response details

Status code Description Response headers
201 A collection of blocks. -
400 The details of the input related failure -
0 Error response -

Back to topBack to API listBack to Model listBack to README