Ejemplo n.º 1
0
    def worker(args):
        """
        1. Create an API client with headers
        2. Create FormGroupForCreate object
        3. POST the form using SDK
        """

        # Step 2 start

        # Create an API with headers
        api_client = create_rooms_api_client(access_token=args["access_token"])

        # Step 2 end

        # Step 3 start

        # Create FormGroupForCreate object
        form = FormGroupForCreate(name=args["form_group_name"])

        # Step 3 end

        # Step 4 start

        # Post the form object using SDK
        form_groups_api = FormGroupsApi(api_client)
        response = form_groups_api.create_form_group(
            body=form, account_id=args["account_id"])

        # Step 4 end

        return response
Ejemplo n.º 2
0
    def get_forms(args):
        """
        1. Create an API client with headers
        2. Get first form library id
        3. Get forms
        """

        # Create an API client with headers
        api_client = create_rooms_api_client(access_token=args["access_token"])

        # Step 3 start

        # Get first form library id
        form_libraries_api = FormLibrariesApi(api_client)
        form_libraries = form_libraries_api.get_form_libraries(
            account_id=args["account_id"]
        )

        first_form_library_id = form_libraries.forms_library_summaries[0].forms_library_id

        # Get forms
        form_library_forms = form_libraries_api.get_form_library_forms(
            form_library_id=first_form_library_id, account_id=args["account_id"]
        )   # type: FormSummaryList
        # Step 3 end
        
        return form_library_forms.forms
    def get_form_groups(args):
        """
        1. Create an API Client with headers
        2. GET Form Groups via FormGroupsAPI
        """

        api_client = create_rooms_api_client(access_token=args["access_token"])

        # Step 4 start

        # GET Form Groups via FormGroupsAPI
        form_groups_api = FormGroupsApi(api_client)
        response = form_groups_api.get_form_groups(
            account_id=args["account_id"])  # type: FormGroupSummaryList

        # Step 4 end

        return response.form_groups
    def get_offices(args):
        """
        1. Create an API Client with headers
        2. Get Offices via OfficesAPI
        """

        # Create an API with headers with headers
        api_client = create_rooms_api_client(args["access_token"])

        # Step 3 start

        # GET offices via OfficesAPI
        offices_api = OfficesApi(api_client=api_client)
        response = offices_api.get_offices(
            account_id=args["account_id"])  # type: OfficeSummaryList

        # Step 3 end

        return response.office_summaries
    def worker(args):
        """
        1. Create an API client with headers
        2. Grant office access to a form group via FormGroups API
        """

        # Step 2 start

        # Create an API client with headers
        api_client = create_rooms_api_client(access_token=args["access_token"])

        # Step 2 end

        # Step 5 start

        # Grant office access to a form group via FormGroups API
        form_groups_api = FormGroupsApi(api_client)

        form_groups_api.grant_office_access_to_form_group(
            form_group_id=args["form_group_id"],
            office_id=args["office_id"],
            account_id=args["account_id"])
Ejemplo n.º 6
0
    def worker(args):
        """
        1. Create an API Client with headers
        2. Create FormGroupFormToAssign Object
        3. Assign form to a form group via FormGroups API
        """

        # Step 2 start

        # Create an API client with headers
        api_client = create_rooms_api_client(access_token=args["access_token"])

        # Step 2 end
        
        form_groups_api = FormGroupsApi(api_client)

        # Step 5 start

        # Create FormGroupFormToAssign Object
        form_group_to_assign = FormGroupFormToAssign(
            form_id=args["form_id"], is_required=True
        )

        # Step 5 end

        # Step 6 start

        # Assign form to a form group via FormGroups API
        response = form_groups_api.assign_form_group_form(
            form_group_id=args["form_group_id"], account_id=args["account_id"],
            body=form_group_to_assign
        )   # type: FormGroupFormToAssign

        # Step 6 end

        return response