Skip to main content

A package for building Platform Guides in Switch Automation Platform.

Project description

Switch Automation library for Python

This is a package for building configurable UI/UX experiences on the Switch Automation software platform.

You can find out more about the platform on Switch Automation

Getting started

Prerequisites

Install the package

Install the Switch Guides library for Python with pip:

pip install switch-guides

History

0.2.7

Updated

  • pydantic version to latest 1.0.0

0.2.6

Updated

  • journey_id is deprecated in favour of guide_id in SwitchGuideStepProcessInput
  • journey_id is also now optional

0.2.5

Added

  • Following attributes to SwitchGuideStepData
    • request_data, request_timestamp, request_component_id

0.2.4

Added

  • options attribute to SwitchGuideStepProcessInput
    • Allows Guide authors to provide additional options while processing the step
    • Attribute is optional and therefore Guide Step authors should take this into account

0.2.3

Added

  • Option for explicitly enabling periodic status checking on Guide Definition level
  • Usage
    •     def definition(self) -> sg.guide.SwitchGuideDefinition:
              return sg.guide.SwitchGuideDefinition(
                  ...
                  options=sg.guide.SwitchGuideDefinitionOptions(
                      enable_live_notification=True
                  )
              )
      

0.2.1

Added

  • Cache Extensions
    • Provides a convenient way of caching data scoped to a Guide
    • Cache is scoped to a Guide Instance and therefore is only available within a Guide Instance and Portfolio the Guide Instance belongs to.
    • Usage - Setter:
      • import switch_guides as sg
        
        guide_id_example = 'dc25bbeb-8504-4ffa-9389-641cc48cc807'
        cache_key_example = 'my-data'
        
        cache_data = {
            'name': '<some-value>',
        }
        
        cache_result = sg.extensions.cache.set_cache(
            api_inputs=api_inputs, guide_id=guide_id_example, key=cache_key_example, val=cache_data)
        
        if not cache_result or not cache_result['success']:
            print('Error setting cache')
            return
        
    • Usage - Getter:
      • import switch_guides as sg
        import json
        
        guide_id_example = 'dc25bbeb-8504-4ffa-9389-641cc48cc807'
        cache_key_example = 'my-data'
        
        cache_result = sg.extensions.cache.get_cache(
            api_inputs=api_inputs, guide_id=guide_id_example, key=cache_key_example)
        
        if not cache_result or not cache_result['success']:
            print('No cache found')
            return
        
        cache_data = json.loads(cache_result['data'])
        

0.1.19

Added

  • publish_update function to GuideStepDefinitionTask base class
    • Allows live updates to be sent to UI when a step is being processed

0.1.18

Fixed

  • Incorrect Marketplace User Type Default Value

0.1.17

Updated

  • Guide Definition Tags structure

0.1.16

Added

  • Step options to SwitchGuideStepDependency to control Step state per Guide definition
  • Extend SwitchGuideDefinitionOptions with availableOnMarketplaceForUserType to control whether the Guide is visible on the Marketplace
    • Options are None, All, or SwitchUserOnly

0.1.15

Added

  • Switch Forms Extensions
    • Provides convenience methods for building and fetching form data
      • See method documentation for more information
      • Usage:
        • import switch_api as sw
          import switch_guides as sg
          
          # Build UI Component
          sg.extensions.forms.define_ui_component(form_id=form_id)
          
          # Fetch Form Data
          form_data = sg.extensions.forms.get_data(api_inputs=api_inputs, form_id=form_id)
          section = form_data.getSectionById(1) # or form_data.getSectionByName('Section Name') 
          field = section.getFieldById(1) # or form_data.getFieldByLabel('Field Label')
          field_value = field.value
          

0.1.14

Updated

  • Improved Guide Definition Registration Responses
    • Errors associated with registration will be available in the responses
  • Documentation for most Guide types and properties

Added

  • Aliases for guide.models modules so they are accessible on top level import
    • Few Examples:
      • import switch_guides as sg
        
        sg.tasks.GuideStepDefinitionTask
        sg.step.SwitchGuideStepDefinition
        sg.guide.SwitchGuideDefinition
        sg.api.SwitchGuideStepProcessInput
        
  • GuideStepDefinitionBackgroundTask that runs process() function in the background allowing users to navigate away from the page.
    • Will work in conjunction with LivelyUI APIs so that user can be given live feedback on the progress of the process method.
  • More step control options:
    • uiState now has continueToNextStep and continueToNextStepWhenAvailable available
    • we can now set uiState on process response without requiring status property to be set
      • Example:
        # Instead of:
        return SwitchGuideStepApiResponse(
            status=SwitchGuideStepStatus(
                uiState=SwitchGuideStepStatusUiState(
                    returnToSummary=True
                )
            )
        )
        
        # We can set uiState as:
        return SwitchGuideStepApiResponse(
            uiState=SwitchGuideStepStatusUiState(
                returnToSummary=True
            )
        )
        

0.1.13

Initial Switch Guides Release

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

switch_guides-0.2.7.tar.gz (23.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

switch_guides-0.2.7-py3-none-any.whl (33.0 kB view details)

Uploaded Python 3

File details

Details for the file switch_guides-0.2.7.tar.gz.

File metadata

  • Download URL: switch_guides-0.2.7.tar.gz
  • Upload date:
  • Size: 23.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for switch_guides-0.2.7.tar.gz
Algorithm Hash digest
SHA256 507064290cfee07e2d6c2d2bfa4c9a29039960e5b4fd5a40950fdba0cb4ea57e
MD5 8b115845c8424a86ed96f6ef65b06e69
BLAKE2b-256 37b0cd33d7830b541d5e34b0ca294f049df052d6baa916ba13d5810b65a101f0

See more details on using hashes here.

File details

Details for the file switch_guides-0.2.7-py3-none-any.whl.

File metadata

  • Download URL: switch_guides-0.2.7-py3-none-any.whl
  • Upload date:
  • Size: 33.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.10

File hashes

Hashes for switch_guides-0.2.7-py3-none-any.whl
Algorithm Hash digest
SHA256 78cf5e6bcab8854df52fb16ed1b5c8acb62c393cb6a98f83ee8319b0eda3f22c
MD5 99a1078b1a20a5669a8af66c622c3042
BLAKE2b-256 55fb2346748cab8c6d64190c049146af02f638d8aa0e1f6c719ca3e5769ea961

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page