Blocks Publish API

Overview

The blocks publish API, provides the users with the capability to publish the blocks to the platform for usage by other users on the platform. For a detailed explanation on how to publish blocks refer to the quick start guide publishing a block

Usage

from razor import BlockScope
razor.api.blocks.publish(scope=BlockScope.ORG, bundle='default')

Arguments

Argument Description
scope This argument filters the blocks available at the scope level. The platform supports two scopes.
1. BlockScope.ORG - Publishes the blocks at a organisation level. i.e. blocks which are global to the organisation
2. BlockScope.PROJECT - Publishes the blocks at a project level, the blocks which are published at a project level are available only for the users of the project
bundlename A name provided to the bundle to which the block belongs
owerwrite A boolean parameter when set to True, updates the existing block
libraries A set of libraries specified, which are dependencies for the block to run

Examples

Publishing a Block

from razor import BlockScope
razor.api.blocks.publish(scope=BlockScope.ORG, bundle='default')

Updating a Block

from razor import BlockScope
razor.api.blocks.publish(scope=BlockScope.ORG, bundle='default', overwrite=True)

Publishing a Block with Libraries

import razor
razor.api.blocks(bundlename='default')

Publishing a block with pre installed libraries

from razor import BlockScope

lib1 = razor.api.libraries(name='user_lib1')
lib2 = razor.api.libraries(name='user_lib2')
razor.api.blocks.publish(
    scope=BlockScope.ORG,
    bundle='default',
    libraries = [lib1, lib2]
)