text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.botservice.models;

import com.azure.core.annotation.Fluent;
import com.fasterxml.jackson.annotation.JsonProperty;

/** The parameters to provide for the Microsoft Teams channel. */
@Fluent
public final class MsTeamsChannelProperties {
    /*
     * Enable calling for Microsoft Teams channel
     */
    @JsonProperty(value = "enableCalling")
    private Boolean enableCalling;

    /*
     * Webhook for Microsoft Teams channel calls
     */
    @JsonProperty(value = "callingWebHook")
    private String callingWebhook;

    /*
     * Whether this channel is enabled for the bot
     */
    @JsonProperty(value = "isEnabled", required = true)
    private boolean isEnabled;

    /*
     * Webhook for Microsoft Teams channel calls
     */
    @JsonProperty(value = "incomingCallRoute")
    private String incomingCallRoute;

    /*
     * Deployment environment for Microsoft Teams channel calls
     */
    @JsonProperty(value = "deploymentEnvironment")
    private String deploymentEnvironment;

    /*
     * Whether this channel accepted terms
     */
    @JsonProperty(value = "acceptedTerms")
    private Boolean acceptedTerms;

    /**
     * Get the enableCalling property: Enable calling for Microsoft Teams channel.
     *
     * @return the enableCalling value.
     */
    public Boolean enableCalling() {
        return this.enableCalling;
    }

    /**
     * Set the enableCalling property: Enable calling for Microsoft Teams channel.
     *
     * @param enableCalling the enableCalling value to set.
     * @return the MsTeamsChannelProperties object itself.
     */
    public MsTeamsChannelProperties withEnableCalling(Boolean enableCalling) {
        this.enableCalling = enableCalling;
        return this;
    }

    /**
     * Get the callingWebhook property: Webhook for Microsoft Teams channel calls.
     *
     * @return the callingWebhook value.
     */
    public String callingWebhook() {
        return this.callingWebhook;
    }

    /**
     * Set the callingWebhook property: Webhook for Microsoft Teams channel calls.
     *
     * @param callingWebhook the callingWebhook value to set.
     * @return the MsTeamsChannelProperties object itself.
     */
    public MsTeamsChannelProperties withCallingWebhook(String callingWebhook) {
        this.callingWebhook = callingWebhook;
        return this;
    }

    /**
     * Get the isEnabled property: Whether this channel is enabled for the bot.
     *
     * @return the isEnabled value.
     */
    public boolean isEnabled() {
        return this.isEnabled;
    }

    /**
     * Set the isEnabled property: Whether this channel is enabled for the bot.
     *
     * @param isEnabled the isEnabled value to set.
     * @return the MsTeamsChannelProperties object itself.
     */
    public MsTeamsChannelProperties withIsEnabled(boolean isEnabled) {
        this.isEnabled = isEnabled;
        return this;
    }

    /**
     * Get the incomingCallRoute property: Webhook for Microsoft Teams channel calls.
     *
     * @return the incomingCallRoute value.
     */
    public String incomingCallRoute() {
        return this.incomingCallRoute;
    }

    /**
     * Set the incomingCallRoute property: Webhook for Microsoft Teams channel calls.
     *
     * @param incomingCallRoute the incomingCallRoute value to set.
     * @return the MsTeamsChannelProperties object itself.
     */
    public MsTeamsChannelProperties withIncomingCallRoute(String incomingCallRoute) {
        this.incomingCallRoute = incomingCallRoute;
        return this;
    }

    /**
     * Get the deploymentEnvironment property: Deployment environment for Microsoft Teams channel calls.
     *
     * @return the deploymentEnvironment value.
     */
    public String deploymentEnvironment() {
        return this.deploymentEnvironment;
    }

    /**
     * Set the deploymentEnvironment property: Deployment environment for Microsoft Teams channel calls.
     *
     * @param deploymentEnvironment the deploymentEnvironment value to set.
     * @return the MsTeamsChannelProperties object itself.
     */
    public MsTeamsChannelProperties withDeploymentEnvironment(String deploymentEnvironment) {
        this.deploymentEnvironment = deploymentEnvironment;
        return this;
    }

    /**
     * Get the acceptedTerms property: Whether this channel accepted terms.
     *
     * @return the acceptedTerms value.
     */
    public Boolean acceptedTerms() {
        return this.acceptedTerms;
    }

    /**
     * Set the acceptedTerms property: Whether this channel accepted terms.
     *
     * @param acceptedTerms the acceptedTerms value to set.
     * @return the MsTeamsChannelProperties object itself.
     */
    public MsTeamsChannelProperties withAcceptedTerms(Boolean acceptedTerms) {
        this.acceptedTerms = acceptedTerms;
        return this;
    }

    /**
     * Validates the instance.
     *
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    public void validate() {
    }
}

redpajama_set_name: RedPajamaGithub


text:
require 'google/apis/core/base_service'
require 'google/apis/core/json_representation'
require 'google/apis/core/hashable'
require 'google/apis/errors'

module Google
  module Apis
    module CloudshellV1alpha1
      # Cloud Shell API
      #
      # Allows users to start, configure, and connect to interactive shell sessions
      #  running in the cloud.
      #
      # @example
      #    require 'google/apis/cloudshell_v1alpha1'
      #
      #    Cloudshell = Google::Apis::CloudshellV1alpha1 # Alias the module
      #    service = Cloudshell::CloudShellService.new
      #
      # @see https://cloud.google.com/shell/docs/
      class CloudShellService < Google::Apis::Core::BaseService
        # @return [String]
        #  API key. Your API key identifies your project and provides you with API access,
        #  quota, and reports. Required unless you provide an OAuth 2.0 token.
        attr_accessor :key

        # @return [String]
        #  Available to use for quota purposes for server-side applications. Can be any
        #  arbitrary string assigned to a user, but should not exceed 40 characters.
        attr_accessor :quota_user

        def initialize
          super('https://cloudshell.googleapis.com/', '',
                client_name: 'google-apis-cloudshell_v1alpha1',
                client_version: Google::Apis::CloudshellV1alpha1::GEM_VERSION)
          @batch_path = 'batch'
        end

        # Sends OAuth credentials to a running environment on behalf of a user. When
        # this completes, the environment will be authorized to run various Google Cloud
        # command line tools without requiring the user to manually authenticate.
        # @param [String] name
        #   Name of the resource that should receive the credentials, for example `users/
        #   me/environments/default` or `users/someone@example.com/environments/default`.
        # @param [Google::Apis::CloudshellV1alpha1::AuthorizeEnvironmentRequest] authorize_environment_request_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::CloudshellV1alpha1::Empty] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::CloudshellV1alpha1::Empty]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def authorize_environment(name, authorize_environment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
          command = make_simple_command(:post, 'v1alpha1/{+name}:authorize', options)
          command.request_representation = Google::Apis::CloudshellV1alpha1::AuthorizeEnvironmentRequest::Representation
          command.request_object = authorize_environment_request_object
          command.response_representation = Google::Apis::CloudshellV1alpha1::Empty::Representation
          command.response_class = Google::Apis::CloudshellV1alpha1::Empty
          command.params['name'] = name unless name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          execute_or_queue_command(command, &block)
        end

        # Gets an environment. Returns NOT_FOUND if the environment does not exist.
        # @param [String] name
        #   Name of the requested resource, for example `users/me/environments/default` or
        #   `users/someone@example.com/environments/default`.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::CloudshellV1alpha1::Environment] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::CloudshellV1alpha1::Environment]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def get_user_environment(name, fields: nil, quota_user: nil, options: nil, &block)
          command = make_simple_command(:get, 'v1alpha1/{+name}', options)
          command.response_representation = Google::Apis::CloudshellV1alpha1::Environment::Representation
          command.response_class = Google::Apis::CloudshellV1alpha1::Environment
          command.params['name'] = name unless name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          execute_or_queue_command(command, &block)
        end

        # Updates an existing environment.
        # @param [String] name
        #   Name of the resource to be updated, for example `users/me/environments/default`
        #   or `users/someone@example.com/environments/default`.
        # @param [Google::Apis::CloudshellV1alpha1::Environment] environment_object
        # @param [String] update_mask
        #   Mask specifying which fields in the environment should be updated.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::CloudshellV1alpha1::Environment] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::CloudshellV1alpha1::Environment]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def patch_user_environment(name, environment_object = nil, update_mask: nil, fields: nil, quota_user: nil, options: nil, &block)
          command = make_simple_command(:patch, 'v1alpha1/{+name}', options)
          command.request_representation = Google::Apis::CloudshellV1alpha1::Environment::Representation
          command.request_object = environment_object
          command.response_representation = Google::Apis::CloudshellV1alpha1::Environment::Representation
          command.response_class = Google::Apis::CloudshellV1alpha1::Environment
          command.params['name'] = name unless name.nil?
          command.query['updateMask'] = update_mask unless update_mask.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          execute_or_queue_command(command, &block)
        end

        # Starts an existing environment, allowing clients to connect to it. The
        # returned operation will contain an instance of StartEnvironmentMetadata in its
        # metadata field. Users can wait for the environment to start by polling this
        # operation via GetOperation. Once the environment has finished starting and is
        # ready to accept connections, the operation will contain a
        # StartEnvironmentResponse in its response field.
        # @param [String] name
        #   Name of the resource that should be started, for example `users/me/
        #   environments/default` or `users/someone@example.com/environments/default`.
        # @param [Google::Apis::CloudshellV1alpha1::StartEnvironmentRequest] start_environment_request_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::CloudshellV1alpha1::Operation] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::CloudshellV1alpha1::Operation]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def start_environment(name, start_environment_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
          command = make_simple_command(:post, 'v1alpha1/{+name}:start', options)
          command.request_representation = Google::Apis::CloudshellV1alpha1::StartEnvironmentRequest::Representation
          command.request_object = start_environment_request_object
          command.response_representation = Google::Apis::CloudshellV1alpha1::Operation::Representation
          command.response_class = Google::Apis::CloudshellV1alpha1::Operation
          command.params['name'] = name unless name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          execute_or_queue_command(command, &block)
        end

        # Adds a public SSH key to an environment, allowing clients with the
        # corresponding private key to connect to that environment via SSH. If a key
        # with the same format and content already exists, this will return the existing
        # key.
        # @param [String] parent
        #   Parent resource name, e.g. `users/me/environments/default`.
        # @param [Google::Apis::CloudshellV1alpha1::CreatePublicKeyRequest] create_public_key_request_object
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::CloudshellV1alpha1::PublicKey] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::CloudshellV1alpha1::PublicKey]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def create_public_key(parent, create_public_key_request_object = nil, fields: nil, quota_user: nil, options: nil, &block)
          command = make_simple_command(:post, 'v1alpha1/{+parent}/publicKeys', options)
          command.request_representation = Google::Apis::CloudshellV1alpha1::CreatePublicKeyRequest::Representation
          command.request_object = create_public_key_request_object
          command.response_representation = Google::Apis::CloudshellV1alpha1::PublicKey::Representation
          command.response_class = Google::Apis::CloudshellV1alpha1::PublicKey
          command.params['parent'] = parent unless parent.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          execute_or_queue_command(command, &block)
        end

        # Removes a public SSH key from an environment. Clients will no longer be able
        # to connect to the environment using the corresponding private key.
        # @param [String] name
        #   Name of the resource to be deleted, e.g. `users/me/environments/default/
        #   publicKeys/my-key`.
        # @param [String] fields
        #   Selector specifying which fields to include in a partial response.
        # @param [String] quota_user
        #   Available to use for quota purposes for server-side applications. Can be any
        #   arbitrary string assigned to a user, but should not exceed 40 characters.
        # @param [Google::Apis::RequestOptions] options
        #   Request-specific options
        #
        # @yield [result, err] Result & error if block supplied
        # @yieldparam result [Google::Apis::CloudshellV1alpha1::Empty] parsed result object
        # @yieldparam err [StandardError] error object if request failed
        #
        # @return [Google::Apis::CloudshellV1alpha1::Empty]
        #
        # @raise [Google::Apis::ServerError] An error occurred on the server and the request can be retried
        # @raise [Google::Apis::ClientError] The request is invalid and should not be retried without modification
        # @raise [Google::Apis::AuthorizationError] Authorization is required
        def delete_user_environment_public_key(name, fields: nil, quota_user: nil, options: nil, &block)
          command = make_simple_command(:delete, 'v1alpha1/{+name}', options)
          command.response_representation = Google::Apis::CloudshellV1alpha1::Empty::Representation
          command.response_class = Google::Apis::CloudshellV1alpha1::Empty
          command.params['name'] = name unless name.nil?
          command.query['fields'] = fields unless fields.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
          execute_or_queue_command(command, &block)
        end

        protected

        def apply_command_defaults(command)
          command.query['key'] = key unless key.nil?
          command.query['quotaUser'] = quota_user unless quota_user.nil?
        end
      end
    end
  end
end


text:
FOSS4G 2013 Tokyo / Osakaのハンズオン「Leaflet&実践的webマップアプリ作成入門」のテキストと実習素材です。

テキストは、./doc_html/index.htmlです。
まずこれをブラウザで開いて、ガイダンスに従って進める形になっています。
後半のLeaflet + Backbone.jsにはDjangoが動作する環境が必要ですが、
もしなくても、./client_only/index.htmlでサーバへのデータ保存処理以外の動作を確認できます。

うまく動かなったり、使い方で不明な点があれば、

https://github.com/monomoti/Leaflet_HandsOn/issues

にご報告ください。

The MIT License (MIT)

Copyright (c) 2013 Takashige Nakagawa

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    xmlns:fancy="http://schemas.android.com/apk/res-auto"
    android:background="@color/transparent">

    <View
        android:id="@+id/view_continued"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:layout_above="@+id/relative_contound"
        android:background="@color/transparent_half_3f"/>

    <RelativeLayout
        android:id="@+id/relative_contound"
        android:layout_width="match_parent"
        android:layout_height="48dp"
        android:layout_above="@+id/cTabLayout_continued"
        android:background="@color/white">

        <TextView
            android:id="@+id/btn_no_continued"
            android:layout_width="58dp"
            android:layout_height="35dp"
            android:layout_centerVertical="true"
            android:gravity="center"
            android:layout_marginLeft="@dimen/dimen_5dp"
            android:textColor="@color/black_aaaa"
            android:textSize="@dimen/dimen_14sp"
            android:text="不续投"
            android:background="@color/white"/>

        <TextView
            android:id="@+id/tv_no_continued"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_centerInParent="true"
            android:layout_marginBottom="1dp"
            android:textColor="@color/black_aaaa"
            android:textSize="@dimen/dimen_14sp"
            android:text="续投设置"
            android:background="@drawable/bg_white_to_gray"/>

        <ImageButton
            android:id="@+id/btn_no_close"
            android:layout_width="32dp"
            android:layout_height="32dp"
            android:layout_alignParentRight="true"
            android:layout_centerVertical="true"
            android:padding="@dimen/dimen_5dp"
            android:layout_marginRight="15dp"
            android:src="@mipmap/ico_close"
            android:background="@color/transparent"
            />
        <View
            android:layout_width="match_parent"
            android:layout_height="1dp"
            android:layout_alignParentBottom="true"
            android:background="@color/grey_f1f1"/>
    </RelativeLayout>

    <com.flyco.tablayout.CommonTabLayout
        android:id="@+id/cTabLayout_continued"
        android:layout_width="match_parent"
        android:layout_height="45dp"
        android:layout_above="@+id/viewpager_continued"
        android:background="@color/white"
        fancy:tl_iconVisible="false"
        fancy:tl_indicator_color="@color/blue_15a4"
        fancy:tl_indicator_height="1dp"
        fancy:tl_textSelectColor="@color/blue_1f80"
        fancy:tl_textUnselectColor="@color/black_3333"
        fancy:tl_textsize="15sp"
        fancy:tl_underline_gravity="BOTTOM"
        fancy:tl_underline_color="@color/blue_15a4"
        fancy:tl_underline_height="0dp">
    </com.flyco.tablayout.CommonTabLayout>
    <android.support.v4.view.ViewPager
        android:id="@+id/viewpager_continued"
        android:layout_width="match_parent"
        android:layout_height="192dp"
        android:background="@color/grey_f1f1"
        android:layout_above="@+id/btn_order_contund_next"
        android:layout_alignParentLeft="true"
        android:layout_alignParentStart="true" />

    <mehdi.sakout.fancybuttons.FancyButton
        android:id="@+id/btn_order_contund_next"
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen_45dp"
        android:layout_alignParentBottom="true"
        android:padding="12dp"
        fancy:fb_borderColor="@color/white"
        fancy:fb_borderWidth="0dp"
        fancy:fb_defaultColor="@color/blue_text"
        fancy:fb_focusColor="@color/blue_0447"
        fancy:fb_radius="0dp"
        fancy:fb_text="确认"
        fancy:fb_textSize="16sp"
        fancy:fb_textColor="@color/white" />

</RelativeLayout>


text:
module Curo

  class InvalidAction < StandardError; end
  class DuplicateTag < StandardError; end
  class DuplicateHost < StandardError; end

  class Runner

    attr_accessor :action, :config

    def initialize config = nil
      @config = config || Curo::Configuration.load
    end

    def run options
      begin
        action   = options.delete(:action)
        options  = options

        raise "No action was specified" if action.nil?

        entry = config.find action

        if entry
          Curo::Connection.new( entry, options ).connect
        else
          case action
            when 'add'    then self.add Curo::Entry.new(options)
            when 'list'   then self.list
            when 'remove' then self.remove options[:entry]
            else raise InvalidAction
          end
        end
      rescue Exception => e
        puts e.message
        exit
      end
    end

    def add entry

      if @config.has_tag?(entry.tag)
        raise DuplicateTag, "Tag already exists for '#{entry.tag}'"
      end
      if @config.has_host?(entry.host)
        raise DuplicateHost, "Host already exists for '#{entry.host}'"
      end

      @config << entry
      @config.save

      msg  = "Saved '#{entry.host}'"
      msg += " with tag " + "'#{entry.tag}'" if entry.has_tag?
      puts msg
    end

    def remove entry_name_or_tag
      @config.remove entry_name_or_tag
      puts "Removed entry for '#{entry_name_or_tag}'"
    end

    def list
      entries = @config.entries
      entries.each do |entry|
        puts entry.to_s
      end
    end

  end
end


text:
// Copyright (c) Microsoft.  All Rights Reserved.  Licensed under the Apache License, Version 2.0.  See License.txt in the project root for license information.

using Microsoft.VisualStudio.Debugger.Evaluation;
using Microsoft.VisualStudio.Debugger.Evaluation.ClrCompilation;

namespace Microsoft.CodeAnalysis.ExpressionEvaluator
{
    internal struct ResultProperties
    {
        public readonly DkmClrCompilationResultFlags Flags;
        public readonly DkmEvaluationResultCategory Category;
        public readonly DkmEvaluationResultAccessType AccessType;
        public readonly DkmEvaluationResultStorageType StorageType;
        public readonly DkmEvaluationResultTypeModifierFlags ModifierFlags;

        public ResultProperties(
            DkmClrCompilationResultFlags flags,
            DkmEvaluationResultCategory category,
            DkmEvaluationResultAccessType accessType,
            DkmEvaluationResultStorageType storageType,
            DkmEvaluationResultTypeModifierFlags modifierFlags)
        {
            this.Flags = flags;
            this.Category = category;
            this.AccessType = accessType;
            this.StorageType = storageType;
            this.ModifierFlags = modifierFlags;
        }

        /// <remarks>
        /// For statements and assignments, we are only interested in <see cref="DkmClrCompilationResultFlags"/>.
        /// </remarks>
        public ResultProperties(DkmClrCompilationResultFlags flags)
            : this(
                  flags,
                  default(DkmEvaluationResultCategory),
                  default(DkmEvaluationResultAccessType),
                  default(DkmEvaluationResultStorageType),
                  default(DkmEvaluationResultTypeModifierFlags))
        {
        }
    }
}


text:
'use strict';

angular.module('app')
    // DO NOT MERGE TO PRODUCTION! FOR STAGING USE ONLY!
    .factory('nrgiDestroySrvc', function($resource) {
        var DestroyResource = $resource('/api/destroy', {}, {
            query: {method: 'GET', isArray: false}
        });

        return DestroyResource;
    });


text:
<?xml version="1.0" encoding="utf-8"?>
<!--
  ~ Copyright (c) 2015 Ha Duy Trung
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->

<resources>

    <!-- =================== -->
    <!-- Application themes  -->
    <!-- =================== -->
    <style name="BaseAppTheme" parent="Theme.AppCompat.Light.NoActionBar">
        <!-- color palette -->
        <item name="colorPrimary">@color/orange300</item>
        <item name="colorPrimaryDark">@color/orange400</item>
        <item name="colorAccent">@color/redA200</item>
        <item name="colorCardBackground">@color/grey100</item>
        <item name="colorCardHighlight">@color/orange100</item>
        <item name="android:textColorPrimary">@color/blackT87</item>
        <item name="android:textColorSecondary">@color/blackT50</item>

        <!-- default theme override -->
        <item name="android:windowDisablePreview">true</item>
        <item name="android:textColorTertiary">?android:textColorPrimary</item>
        <item name="android:textColorLink">?colorAccent</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="actionModeBackground">?colorPrimary</item>
        <item name="alertDialogTheme">@style/AppAlertDialog</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog</item>
        <item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
        <item name="popupMenuStyle">@style/Widget.AppCompat.Light.PopupMenu.Overflow</item>
        <item name="drawerArrowStyle">@style/AppDrawerArrowToggle</item>

        <!-- custom themed attributes -->
        <item name="titleTextSize">@dimen/text_size_medium</item>
        <item name="subtitleTextSize">@dimen/text_size_small</item>
        <item name="contentTextSize">@dimen/text_size_small</item>
        <item name="backgroundDrawerHeader">@drawable/bg_drawer_light</item>
    </style>

    <style name="BaseAppTheme.Dark" parent="Theme.AppCompat.NoActionBar">
        <!-- color palette -->
        <item name="colorPrimary">@color/grey900</item>
        <item name="colorPrimaryDark">@color/blackT87</item>
        <item name="colorAccent">@color/redA100</item>
        <item name="colorCardBackground">@color/grey900</item>
        <item name="colorCardHighlight">@color/grey800</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:textColorSecondary">@color/whiteT50</item>

        <!-- default theme override -->
        <item name="android:windowDisablePreview">true</item>
        <item name="android:textColorTertiary">?android:textColorPrimary</item>
        <item name="android:textColorLink">?colorAccent</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="actionModeBackground">?colorPrimary</item>
        <item name="alertDialogTheme">@style/AppAlertDialog.Dark</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog.Dark</item>
        <item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
        <item name="popupMenuStyle">@style/Widget.AppCompat.PopupMenu.Overflow</item>
        <item name="drawerArrowStyle">@style/AppDrawerArrowToggle</item>

        <!-- custom themed attributes -->
        <item name="titleTextSize">@dimen/text_size_medium</item>
        <item name="subtitleTextSize">@dimen/text_size_small</item>
        <item name="contentTextSize">@dimen/text_size_small</item>
        <item name="backgroundDrawerHeader">@drawable/bg_drawer_dark</item>
    </style>

    <style name="BaseAppTheme.DayNight.NoActionBar" parent="Theme.AppCompat.DayNight.NoActionBar">
        <!-- default theme override -->
        <item name="android:windowDisablePreview">true</item>
        <item name="android:textColorTertiary">?android:textColorPrimary</item>
        <item name="android:textColorLink">?colorAccent</item>
        <item name="windowActionModeOverlay">true</item>
        <item name="actionModeBackground">?colorPrimary</item>
        <item name="preferenceTheme">@style/AppPreferenceThemeOverlay</item>
        <item name="popupMenuStyle">@style/Widget.AppCompat.Light.PopupMenu.Overflow</item>
        <item name="drawerArrowStyle">@style/AppDrawerArrowToggle</item>

        <!-- custom themed attributes -->
        <item name="titleTextSize">@dimen/text_size_medium</item>
        <item name="subtitleTextSize">@dimen/text_size_small</item>
        <item name="contentTextSize">@dimen/text_size_small</item>
    </style>

    <style name="BaseAppTheme.DayNight" parent="BaseAppTheme.DayNight.NoActionBar">
        <!-- color palette -->
        <item name="colorPrimary">@color/orange300</item>
        <item name="colorPrimaryDark">@color/orange400</item>
        <item name="colorAccent">@color/redA200</item>
        <item name="colorCardBackground">@color/grey100</item>
        <item name="colorCardHighlight">@color/orange100</item>
        <item name="android:textColorPrimary">@color/blackT87</item>
        <item name="android:textColorSecondary">@color/blackT50</item>

        <!-- default theme override -->
        <item name="alertDialogTheme">@style/AppAlertDialog</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog</item>

        <!-- custom themed attributes -->
        <item name="backgroundDrawerHeader">@drawable/bg_drawer_light</item>
    </style>

    <style name="AppTheme" parent="BaseAppTheme">
    </style>

    <style name="AppTheme.Translucent">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:backgroundDimEnabled">true</item>
    </style>

    <style name="AppTheme.Dark" parent="BaseAppTheme.Dark">
    </style>

    <style name="AppTheme.Dark.Translucent">
        <item name="android:windowIsTranslucent">true</item>
        <item name="android:windowBackground">@android:color/transparent</item>
        <item name="android:backgroundDimEnabled">true</item>
    </style>

    <style name="AppTheme.DayNight" parent="BaseAppTheme.DayNight">
    </style>

    <style name="Black">
        <item name="colorPrimary">@color/grey900</item>
        <item name="colorPrimaryDark">@color/blackT87</item>
        <item name="colorAccent">@color/redA100</item>
        <item name="colorCardBackground">@color/blackT87</item>
        <item name="colorCardHighlight">@color/grey900</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:textColorSecondary">@color/whiteT70</item>
        <item name="alertDialogTheme">@style/AppAlertDialog.Dark</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog.Dark</item>
    </style>

    <style name="Sepia">
        <item name="colorPrimary">@color/orange300</item>
        <item name="colorPrimaryDark">@color/orange400</item>
        <item name="colorCardBackground">@color/orange50</item>
        <item name="android:textColorPrimary">@color/brown800</item>
        <item name="android:textColorSecondary">@color/brown400</item>
        <item name="alertDialogTheme">@style/AppAlertDialog.Sepia</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog.Sepia</item>
    </style>

    <style name="Green">
        <item name="colorPrimary">@color/teal300</item>
        <item name="colorPrimaryDark">@color/teal400</item>
        <item name="colorCardBackground">@color/teal50</item>
        <item name="colorCardHighlight">@color/teal100</item>
        <item name="android:textColorPrimary">@color/teal900</item>
        <item name="android:textColorSecondary">@color/teal600</item>
        <item name="alertDialogTheme">@style/AppAlertDialog.Green</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog.Green</item>
    </style>

    <style name="Solarized">
        <item name="colorPrimary">@color/orange300</item>
        <item name="colorPrimaryDark">@color/orange400</item>
        <item name="colorAccent">@color/solarizedOrange</item>
        <item name="colorCardBackground">@color/solarizedBase3</item>
        <item name="colorCardHighlight">@color/solarizedBase2</item>
        <item name="android:textColorPrimary">@color/solarizedBase01</item>
        <item name="android:textColorSecondary">@color/solarizedBase1</item>
        <item name="alertDialogTheme">@style/AppAlertDialog.Solarized</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog.Solarized</item>
    </style>

    <style name="BaseDarkSolarized">
        <item name="colorPrimary">@color/grey900</item>
        <item name="colorPrimaryDark">@color/blackT87</item>
        <item name="colorAccent">@color/solarizedOrange</item>
        <item name="colorCardBackground">@color/solarizedBase03</item>
        <item name="colorCardHighlight">@color/solarizedBase02</item>
        <item name="android:textColorPrimary">@color/solarizedBase2</item>
        <item name="android:textColorSecondary">@color/solarizedBase1</item>
        <item name="alertDialogTheme">@style/AppAlertDialog.Dark.Solarized</item>
        <item name="bottomSheetDialogTheme">@style/AppBottomSheetDialog.Dark.Solarized</item>
    </style>

    <style name="Solarized.Dark" parent="BaseDarkSolarized">
    </style>

    <!-- =================== -->
    <!-- Alert dialog themes -->
    <!-- =================== -->
    <style name="AppAlertDialog" parent="Theme.AppCompat.Light.Dialog.Alert">
        <item name="colorPrimary">@color/orange400</item>
        <item name="colorAccent">@color/redA200</item>
        <item name="android:textColorPrimary">@color/blackT87</item>
        <item name="android:textColorSecondary">@color/blackT50</item>
        <item name="android:textColorTertiary">?android:textColorPrimary</item>
        <item name="android:textColorLink">?colorAccent</item>
        <item name="colorCardBackground">@color/grey100</item>
        <item name="colorCardHighlight">@color/orange100</item>
        <item name="backgroundDrawerHeader">@drawable/bg_drawer_light</item>
    </style>

    <style name="AppAlertDialog.Dark" parent="Theme.AppCompat.Dialog.Alert">
        <item name="colorAccent">@color/redA100</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:textColorSecondary">@color/whiteT50</item>
        <item name="android:textColorTertiary">?android:textColorPrimary</item>
        <item name="android:textColorLink">?colorAccent</item>
        <item name="colorCardBackground">@color/cardDarkBackground</item>
        <item name="colorCardHighlight">@color/grey800</item>
        <item name="backgroundDrawerHeader">@drawable/bg_drawer_dark</item>
    </style>

    <style name="AppAlertDialog.Sepia">
        <item name="colorPrimary">@color/orange300</item>
        <item name="android:textColorPrimary">@color/brown800</item>
        <item name="android:textColorSecondary">@color/brown400</item>
        <item name="colorCardBackground">@color/orange50</item>
    </style>

    <style name="AppAlertDialog.Green">
        <item name="colorPrimary">@color/teal300</item>
        <item name="android:textColorPrimary">@color/teal900</item>
        <item name="android:textColorSecondary">@color/teal600</item>
        <item name="colorCardBackground">@color/teal50</item>
        <item name="colorCardHighlight">@color/teal100</item>
    </style>

    <style name="AppAlertDialog.Solarized">
        <item name="colorPrimary">@color/orange300</item>
        <item name="android:textColorPrimary">@color/solarizedBase01</item>
        <item name="android:textColorSecondary">@color/solarizedBase1</item>
        <item name="colorCardBackground">@color/solarizedBase3</item>
        <item name="colorCardHighlight">@color/solarizedBase2</item>
    </style>

    <style name="AppAlertDialog.Dark.Solarized">
        <item name="colorPrimary">@color/grey900</item>
        <item name="android:textColorPrimary">@color/solarizedBase2</item>
        <item name="android:textColorSecondary">@color/solarizedBase1</item>
        <item name="colorCardBackground">@color/solarizedBase03</item>
        <item name="colorCardHighlight">@color/solarizedBase02</item>
    </style>

    <style name="AppBottomSheetDialog" parent="Theme.Design.Light.BottomSheetDialog">
        <item name="colorAccent">@color/redA200</item>
        <item name="android:textColorPrimary">@color/blackT87</item>
        <item name="android:textColorSecondary">@color/blackT50</item>
        <item name="android:textColorTertiary">?android:textColorPrimary</item>
        <item name="android:colorBackground">@color/grey100</item>
    </style>

    <style name="AppBottomSheetDialog.Dark" parent="Theme.Design.BottomSheetDialog">
        <item name="colorAccent">@color/redA100</item>
        <item name="android:textColorPrimary">@color/white</item>
        <item name="android:textColorSecondary">@color/whiteT50</item>
        <item name="android:textColorTertiary">?android:textColorPrimary</item>
        <item name="android:colorBackground">@color/cardDarkBackground</item>
    </style>

    <style name="AppBottomSheetDialog.Sepia">
        <item name="colorPrimary">@color/orange300</item>
        <item name="android:textColorPrimary">@color/brown800</item>
        <item name="android:textColorSecondary">@color/brown400</item>
        <item name="android:colorBackground">@color/orange50</item>
    </style>

    <style name="AppBottomSheetDialog.Green">
        <item name="colorPrimary">@color/teal300</item>
        <item name="android:textColorPrimary">@color/teal900</item>
        <item name="android:textColorSecondary">@color/teal600</item>
        <item name="android:colorBackground">@color/teal50</item>
    </style>

    <style name="AppBottomSheetDialog.Solarized">
        <item name="colorPrimary">@color/orange300</item>
        <item name="android:textColorPrimary">@color/solarizedBase01</item>
        <item name="android:textColorSecondary">@color/solarizedBase1</item>
        <item name="android:colorBackground">@color/solarizedBase3</item>
    </style>

    <style name="AppBottomSheetDialog.Dark.Solarized">
        <item name="colorPrimary">@color/grey900</item>
        <item name="android:textColorPrimary">@color/solarizedBase2</item>
        <item name="android:textColorSecondary">@color/solarizedBase1</item>
        <item name="android:colorBackground">@color/solarizedBase03</item>
    </style>

</resources>


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>Emprestar</title>
<meta name="date" content="2011-11-29">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method

br.org.olimpiabarbacena.client.formulario.midia

Class Emprestar

java.lang.Object

com.google.gwt.user.client.ui.UIObject

com.google.gwt.user.client.ui.Widget

com.google.gwt.user.client.ui.Composite

br.org.olimpiabarbacena.client.formulario.midia.Emprestar

All Implemented Interfaces:

com.google.gwt.event.logical.shared.HasAttachHandlers, com.google.gwt.event.shared.HasHandlers, com.google.gwt.user.client.EventListener, com.google.gwt.user.client.ui.HasVisibility, com.google.gwt.user.client.ui.IsRenderable, com.google.gwt.user.client.ui.IsWidget

public class Emprestar
extends com.google.gwt.user.client.ui.Composite

 Este é o formulário para inserção de
 Empréstimo de Mídia.

 Esta classe está no pacote formulario porque é
 onde se encontram todos os formulários do cliente. No cliente,
 nós permitimos o fornecimento de informações para serem
 enviados por uma requisição RPC. No servidor, nós
 inserimos os dados fornecidos caso não possua uma
 identificação ou salvamos caso exista uma
 identificação.

Nested Class Summary

Nested classes/interfaces inherited from class com.google.gwt.user.client.ui.UIObject

com.google.gwt.user.client.ui.UIObject.DebugIdImpl, com.google.gwt.user.client.ui.UIObject.DebugIdImplEnabled

Field Summary

Fields inherited from class com.google.gwt.user.client.ui.UIObject

DEBUG_ID_PREFIX

Constructor Summary

Constructors

Constructor and Description

Emprestar(Midia midia,
         com.google.gwt.user.client.ui.DialogBox dialogo)

Method Summary

Methods inherited from class com.google.gwt.user.client.ui.Composite

isAttached, onBrowserEvent, performDetachedInitialization, render, render, wrapElement

Methods inherited from class com.google.gwt.user.client.ui.Widget

addAttachHandler, addBitlessDomHandler, addDomHandler, addHandler, asWidget, asWidgetOrNull, fireEvent, getLayoutData, getParent, removeFromParent, setLayoutData, sinkEvents

Methods inherited from class com.google.gwt.user.client.ui.UIObject

addStyleDependentName, addStyleName, ensureDebugId, ensureDebugId, getAbsoluteLeft, getAbsoluteTop, getElement, getOffsetHeight, getOffsetWidth, getStyleName, getStylePrimaryName, getTitle, isVisible, isVisible, removeStyleDependentName, removeStyleName, setHeight, setPixelSize, setSize, setStyleDependentName, setStyleName, setStyleName, setStylePrimaryName, setTitle, setVisible, setVisible, setWidth, sinkBitlessEvent, toString, unsinkEvents

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, wait, wait, wait

Constructor Detail

Emprestar

public Emprestar(Midia midia,
         com.google.gwt.user.client.ui.DialogBox dialogo)

Overview

Package

Class

Use

Tree

Deprecated

Index

Help

Prev Class

Next Class

Frames

No Frames

All Classes

Summary:

Nested |

Field |

Constr |

Method

Detail:

Field |

Constr |

Method


text:
<?xml version="1.0" encoding="UTF-8"?>
<beans:beans xmlns="http://www.springframework.org/schema/osgi"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:beans="http://www.springframework.org/schema/beans"
	xmlns:osgi="http://www.springframework.org/schema/osgi"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
                      http://www.springframework.org/schema/osgi http://www.springframework.org/schema/osgi/spring-osgi.xsd"
	osgi:default-timeout="10" osgi:default-cardinality="0..X">

	<list id="reference-list" interface="java.awt.Shape" member-type="service-reference" availability="optional">
		<listener bind-method="bind" unbind-method="unbind" ref="listener"/>
	</list>

 	<beans:bean id="listener" class="org.springframework.osgi.iandt.importer.Listener"/>

</beans:beans>


text:
package kt4.base;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;

import com.google.gson.Gson;
import com.squareup.okhttp.Callback;
import com.squareup.okhttp.OkHttpClient;
import com.squareup.okhttp.Request;
import com.squareup.okhttp.Response;

import java.io.IOException;

import kt4.base.model.Question;
import kt4.base.model.QuestionsResponseWrapper;

/**
 * A placeholder fragment containing a simple view.
 */
public class QuestionListFragment extends Fragment {

    private static final String TAG = "LOGTAG";

    private final static String REQUEST_URL = "https://api.stackexchange.com/2.2/questions?" +
            "order=desc&sort=activity&tagged=android&site=stackoverflow";

    public QuestionListFragment() {
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container,
                             Bundle savedInstanceState) {

        requestQuestions();

        return inflater.inflate(R.layout.fragment_main, container, false);
    }

    private void requestQuestions() {
        OkHttpClient client = new OkHttpClient();

        Request request = new Request.Builder().url(REQUEST_URL).build();

        client.newCall(request).enqueue(new Callback() {
            @Override
            public void onFailure(Request request, IOException e) {
                Log.e(TAG, e + "");
            }

            @Override
            public void onResponse(Response response) throws IOException {
                if (response == null)
                    return;

                Log.i(TAG, "Response code: " + response.code());

                QuestionsResponseWrapper parsedResponse = parse(response);

                attachToListview(parsedResponse);

            }
        });
    }

    private void attachToListview(QuestionsResponseWrapper questionsResponseWrapper) {
        final ArrayAdapter<Question> adapter =
                new ArrayAdapter<>(getActivity().getBaseContext(),
                        android.R.layout.simple_list_item_1,
                        questionsResponseWrapper.items);

        getActivity().runOnUiThread(new Runnable() {
            @Override
            public void run() {
                ListView listView = (ListView) getActivity().findViewById(R.id.listView);
                listView.setAdapter(adapter);
            }
        });
    }

    private QuestionsResponseWrapper parse(Response response) throws IOException {
        String inputJson = response.body().string();
        return new Gson().fromJson(inputJson,
                QuestionsResponseWrapper.class);
    }

}


text:
import {
  CompileTemplateMetadata,
  CompileIdentifierMetadata,
  CompileDirectiveMetadata
} from './compile_metadata';
import * as o from './output/output_ast';
import {ViewEncapsulation} from 'angular2/src/core/metadata/view';
import {ShadowCss} from 'angular2/src/compiler/shadow_css';
import {UrlResolver} from 'angular2/src/compiler/url_resolver';
import {extractStyleUrls} from './style_url_resolver';
import {Injectable} from 'angular2/src/core/di';
import {isPresent} from 'angular2/src/facade/lang';

const COMPONENT_VARIABLE = '%COMP%';
const HOST_ATTR = `_nghost-${COMPONENT_VARIABLE}`;
const CONTENT_ATTR = `_ngcontent-${COMPONENT_VARIABLE}`;

export class StylesCompileDependency {
  constructor(public sourceUrl: string, public isShimmed: boolean,
              public valuePlaceholder: CompileIdentifierMetadata) {}
}

export class StylesCompileResult {
  constructor(public statements: o.Statement[], public stylesVar: string,
              public dependencies: StylesCompileDependency[]) {}
}

@Injectable()
export class StyleCompiler {
  private _shadowCss: ShadowCss = new ShadowCss();

  constructor(private _urlResolver: UrlResolver) {}

  compileComponent(comp: CompileDirectiveMetadata): StylesCompileResult {
    var shim = comp.template.encapsulation === ViewEncapsulation.Emulated;
    return this._compileStyles(getStylesVarName(comp), comp.template.styles,
                               comp.template.styleUrls, shim);
  }

  compileStylesheet(stylesheetUrl: string, cssText: string,
                    isShimmed: boolean): StylesCompileResult {
    var styleWithImports = extractStyleUrls(this._urlResolver, stylesheetUrl, cssText);
    return this._compileStyles(getStylesVarName(null), [styleWithImports.style],
                               styleWithImports.styleUrls, isShimmed);
  }

  private _compileStyles(stylesVar: string, plainStyles: string[], absUrls: string[],
                         shim: boolean): StylesCompileResult {
    var styleExpressions =
        plainStyles.map(plainStyle => o.literal(this._shimIfNeeded(plainStyle, shim)));
    var dependencies = [];
    for (var i = 0; i < absUrls.length; i++) {
      var identifier = new CompileIdentifierMetadata({name: getStylesVarName(null)});
      dependencies.push(new StylesCompileDependency(absUrls[i], shim, identifier));
      styleExpressions.push(new o.ExternalExpr(identifier));
    }
    // styles variable contains plain strings and arrays of other styles arrays (recursive),
    // so we set its type to dynamic.
    var stmt = o.variable(stylesVar)
                   .set(o.literalArr(styleExpressions,
                                     new o.ArrayType(o.DYNAMIC_TYPE, [o.TypeModifier.Const])))
                   .toDeclStmt(null, [o.StmtModifier.Final]);
    return new StylesCompileResult([stmt], stylesVar, dependencies);
  }

  private _shimIfNeeded(style: string, shim: boolean): string {
    return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style;
  }
}

function getStylesVarName(component: CompileDirectiveMetadata): string {
  var result = `styles`;
  if (isPresent(component)) {
    result += `_${component.type.name}`;
  }
  return result;
}


text:
<?php

class Google_Service_Sheets_GradientRule extends Google_Model
{
  protected $maxpointType = 'Google_Service_Sheets_InterpolationPoint';
  protected $maxpointDataType = '';
  protected $midpointType = 'Google_Service_Sheets_InterpolationPoint';
  protected $midpointDataType = '';
  protected $minpointType = 'Google_Service_Sheets_InterpolationPoint';
  protected $minpointDataType = '';

  /**
   * @param Google_Service_Sheets_InterpolationPoint
   */
  public function setMaxpoint(Google_Service_Sheets_InterpolationPoint $maxpoint)
  {
    $this->maxpoint = $maxpoint;
  }
  /**
   * @return Google_Service_Sheets_InterpolationPoint
   */
  public function getMaxpoint()
  {
    return $this->maxpoint;
  }
  /**
   * @param Google_Service_Sheets_InterpolationPoint
   */
  public function setMidpoint(Google_Service_Sheets_InterpolationPoint $midpoint)
  {
    $this->midpoint = $midpoint;
  }
  /**
   * @return Google_Service_Sheets_InterpolationPoint
   */
  public function getMidpoint()
  {
    return $this->midpoint;
  }
  /**
   * @param Google_Service_Sheets_InterpolationPoint
   */
  public function setMinpoint(Google_Service_Sheets_InterpolationPoint $minpoint)
  {
    $this->minpoint = $minpoint;
  }
  /**
   * @return Google_Service_Sheets_InterpolationPoint
   */
  public function getMinpoint()
  {
    return $this->minpoint;
  }
}


text:
import datetime
import json
import logging

import requests
from dateutil.parser import parse
from flask import current_app as app
from structlog import wrap_logger
from werkzeug.exceptions import NotFound

from frontstage.common.thread_wrapper import ThreadWrapper
from frontstage.common.utilities import obfuscate_email
from frontstage.common.verification import decode_email_token
from frontstage.controllers import case_controller, survey_controller
from frontstage.exceptions.exceptions import ApiError, UserDoesNotExist

CLOSED_STATE = ["COMPLETE", "COMPLETEDBYPHONE", "NOLONGERREQUIRED"]

logger = wrap_logger(logging.getLogger(__name__))

def get_respondent_party_by_id(party_id: str) -> dict:
    logger.info("Retrieving party from party service by id", party_id=party_id)

    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/id/{party_id}"
    response = requests.get(url, auth=app.config["BASIC_AUTH"])

    if response.status_code == 404:
        return

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to find respondent", party_id=party_id)
        raise ApiError(logger, response)

    logger.info("Successfully retrieved party details", party_id=party_id)
    return response.json()

def add_survey(party_id, enrolment_code):
    logger.info("Attempting to add a survey", party_id=party_id)

    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/add_survey"
    request_json = {"party_id": party_id, "enrolment_code": enrolment_code}
    response = requests.post(url, auth=app.config["BASIC_AUTH"], json=request_json)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to add a survey", party_id=party_id, enrolment_code=enrolment_code)
        raise ApiError(logger, response)

    logger.info("Successfully added a survey", party_id=party_id, enrolment_code=enrolment_code)

def change_password(email, password):
    bound_logger = logger.bind(email=obfuscate_email(email))
    bound_logger.info("Attempting to change password through the party service")

    data = {"email_address": email, "new_password": password}
    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/change_password"
    response = requests.put(url, auth=app.config["BASIC_AUTH"], json=data)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        bound_logger.error("Failed to send change password request to party service")
        raise ApiError(logger, response)

    bound_logger.info("Successfully changed password through the party service")

def create_account(registration_data: dict) -> None:
    obfuscated_email = obfuscate_email(registration_data["emailAddress"])
    enrolment_code = registration_data["enrolmentCode"]
    logger.info("Attempting to create account", email=obfuscated_email, enrolment_code=enrolment_code)

    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents"
    registration_data["status"] = "CREATED"
    response = requests.post(url, auth=app.config["BASIC_AUTH"], json=registration_data)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        if response.status_code == 409:
            logger.info("Email has already been used", email=obfuscated_email, enrolment_code=enrolment_code)
        else:
            logger.error("Failed to create account", email=obfuscated_email, enrolment_code=enrolment_code)
        raise ApiError(logger, response, message=response.json())

    logger.info("Successfully created account", email=obfuscated_email, enrolment_code=enrolment_code)

def update_account(respondent_data):
    logger.info("Attempting to update account", party_id=respondent_data["id"])

    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/id/{respondent_data['id']}"
    response = requests.put(url, auth=app.config["BASIC_AUTH"], json=respondent_data)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to update account", party_id=respondent_data["id"])
        raise ApiError(logger, response)

    logger.info("Successfully updated account", party_id=respondent_data["id"])

def get_party_by_business_id(party_id, party_url, party_auth, collection_exercise_id=None, verbose=True):
    logger.info(
        "Attempting to retrieve party by business", party_id=party_id, collection_exercise_id=collection_exercise_id
    )

    url = f"{party_url}/party-api/v1/businesses/id/{party_id}"
    params = {}
    if collection_exercise_id:
        params["collection_exercise_id"] = collection_exercise_id
    if verbose:
        params["verbose"] = True
    response = requests.get(url, params=params, auth=party_auth)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error(
            "Failed to retrieve party by business", party_id=party_id, collection_exercise_id=collection_exercise_id
        )
        raise ApiError(logger, response)

    logger.info(
        "Successfully retrieved party by business", party_id=party_id, collection_exercise_id=collection_exercise_id
    )
    return response.json()

"""
This import had to be moved as redis_cache calls the get_party_by_business_id method which needs to be
initialised before being used
"""
from frontstage.common.redis_cache import RedisCache  # NOQA: E402

def get_respondent_by_email(email):
    bound_logger = logger.bind(email=obfuscate_email(email))
    bound_logger.info("Attempting to find respondent party by email")

    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/email"
    response = requests.get(url, json={"email": email}, auth=app.config["BASIC_AUTH"])

    if response.status_code == 404:
        bound_logger.info("Failed to retrieve party by email")
        return

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        bound_logger.error("Error retrieving respondent by email")
        raise ApiError(logger, response)

    bound_logger.info("Successfully retrieved respondent by email")
    return response.json()

def resend_verification_email(party_id):
    logger.info("Re-sending verification email", party_id=party_id)
    url = f'{app.config["PARTY_URL"]}/party-api/v1/resend-verification-email/{party_id}'
    response = requests.post(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.exception("Re-sending of verification email failed", party_id=party_id)
        raise ApiError(logger, response)
    logger.info("Successfully re-sent verification email", party_id=party_id)

def resend_verification_email_expired_token(token):
    logger.info("Re-sending verification email", token=token)
    url = f'{app.config["PARTY_URL"]}/party-api/v1/resend-verification-email-expired-token/{token}'
    response = requests.post(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Re-sending of verification email for expired token failed")
        raise ApiError(logger, response)
    logger.info("Successfully re-sent verification email", token=token)

def resend_account_email_change_expired_token(token):
    logger.info("Re-sending account email change verification email", token=token)
    url = f'{app.config["PARTY_URL"]}/party-api/v1/resend-account-email-change-expired-token/{token}'
    response = requests.post(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Re-sending of verification email for expired token failed", token=token)
        raise ApiError(logger, response)
    logger.info("Successfully re-sent verification email", token=token)

def reset_password_request(username):
    bound_logger = logger.bind(email=obfuscate_email(username))
    bound_logger.info("Attempting to send reset password request to party service")

    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/request_password_change"
    data = {"email_address": username}
    response = requests.post(url, auth=app.config["BASIC_AUTH"], json=data)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        if response.status_code == 404:
            raise UserDoesNotExist("User does not exist in party service")
        bound_logger.error("Failed to send reset password request to party service")
        raise ApiError(logger, response)

    bound_logger.info("Successfully sent reset password request to party service")

def resend_password_email_expired_token(token):
    logger.info("Re-sending password email", token=token)
    url = f'{app.config["PARTY_URL"]}/party-api/v1/resend-password-email-expired-token/{token}'
    response = requests.post(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Re-sending of password email for expired token failed")
        raise ApiError(logger, response)
    logger.info("Sucessfully re-sent password email", token=token)

def verify_email(token):
    logger.info("Attempting to verify email address", token=token)

    url = f"{app.config['PARTY_URL']}/party-api/v1/emailverification/{token}"
    response = requests.put(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to verify email", token=token)
        raise ApiError(logger, response)

    logger.info("Successfully verified email address", token=token)

def verify_token(token):
    logger.info("Attempting to verify token with party service", token=token)

    url = f"{app.config['PARTY_URL']}/party-api/v1/tokens/verify/{token}"
    response = requests.get(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to verify token", token=token)
        raise ApiError(logger, response)

    logger.info("Successfully verified token", token=token)

def verify_pending_survey_token(token):
    """
    Gives call to party service to verify share/transfer survey token
    """
    logger.info("Attempting to verify share/transfer survey token with party service", token=token)

    url = f"{app.config['PARTY_URL']}/party-api/v1/pending-survey/verification/{token}"
    response = requests.get(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to verify share/transfer survey token", token=token)
        raise ApiError(logger, response)

    logger.info("Successfully verified token", token=token)
    return response

def confirm_pending_survey(batch_number):
    """
    gives call to party service to confirm pending share/transfer survey
    """
    logger.info("Attempting to confirm share/transfer survey with party service", batch_number=batch_number)

    url = f"{app.config['PARTY_URL']}/party-api/v1/pending-survey/confirm-pending-surveys/{batch_number}"
    response = requests.post(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to confirm share/transfer survey with batch number", batch_number=batch_number)
        raise ApiError(logger, response)

    logger.info("Successfully confirmed share/transfer survey", batch_number=batch_number)
    return response

def get_respondent_enrolments(respondent: dict):
    """
    Returns a generator containing all the business_id and survey_id for all the active enrolments for the
    respondent.

    :param respondent: A dict containing respondent data
    """
    if "associations" in respondent:
        for association in respondent["associations"]:
            for enrolment in association["enrolments"]:
                if enrolment["enrolmentStatus"] == "ENABLED":
                    yield {"business_id": association["partyId"], "survey_id": enrolment["surveyId"]}

def get_respondent_enrolments_for_started_collex(enrolment_data, collection_exercises):
    """This will only filter out enrolments for surveys that have 0 live collection exercises.

    Needed because enrolment_data includes not started enrolments ,
    but cache_collex only contains started collex. Hence indexing collex by enrolment[survey] causes a 500

    :param enrolment_data: A list of enrolments.
    :type enrolment_data: list
    :param collection_exercises: A list of collection exercises.
    :type collection_exercises: list
    :return: list of enrolments corresponding to the known collection exercises
    """

    enrolments = []
    for enrolment in enrolment_data:
        if enrolment["survey_id"] in collection_exercises:
            enrolments.append(enrolment)
    return enrolments

def get_unique_survey_and_business_ids(enrolment_data):
    """Takes a list of enrolment data and returns 2 unique sets of business_id and party_id's

    :param enrolment_data: A list of enrolments
    :return: A pair of sets with deduplicated survey_id's and business_id's
    """

    surveys_ids = set()
    business_ids = set()
    for enrolment in enrolment_data:
        surveys_ids.add(enrolment["survey_id"])
        business_ids.add(enrolment["business_id"])
    return surveys_ids, business_ids

def caching_case_data(cache_data, business_ids, tag):
    # Creates a list of threads which will call functions to set the case in the cache_data.
    threads = []

    for business_id in business_ids:
        threads.append(
            ThreadWrapper(get_case, cache_data, business_id, app.config["CASE_URL"], app.config["BASIC_AUTH"], tag)
        )

    for thread in threads:
        thread.start()

    # We do a thread join to make sure that the threads have all terminated before it carries on
    for thread in threads:
        thread.join()

def get_survey_list_details_for_party(respondent: dict, tag: str, business_party_id: str, survey_id: str):
    """
    Gets a list of cases (and any useful metadata) for a respondent.  Depending on the tag the list of cases will be
    ones that require action (in the form of an EQ or SEFT submission); Or they will be cases that have been completed
    and are used to see what has been submitted in the past.

    This function uses threads and caching to get data from Case, Party, Collection exercise, Survey and
    Collection Instrument services. Without this, respondents with a large number of cases can experience page timeouts
    as it'll take too long to load due to repeated calls for the same information from the services.

    There isn't a direct link between respondent and the cases they're involved in.  Instead we can work out what
    cases they're involved in via an implicit and indirect link between:
        - The combination of survey and business a respondent is enrolled for, and;
        - the cases and collection exercises the business is involved in

    The algorithm for determining this is roughly:
      - Get all survey enrolments for the respondent
      - For each enrolment:
          - Get the business details the enrolment is for
          - Get the live-but-not-ended collection exercises for the survey the enrolment is for
          - Get the cases the business is part of, from the list of collection exercises. Note, this isn't every case
            against the business; depending on if you're looking at the to-do or history page, you'll get a different
            subset of them.
          - For each case in this list:
              - Create an entry in the returned list for each of these cases as the respondent is implicitly part
                of the case by being enrolled for the survey with that business.

    :param respondent: A dict containing respondent data
    :param tag: This is the page that is being called e.g. to-do, history
    :param business_party_id: This is the businesses uuid
    :param survey_id: This is the surveys uuid

    """
    enrolment_data = list(get_respondent_enrolments(respondent))

    # Gets the survey ids and business ids from the enrolment data that has been generated.
    # Converted to list to avoid multiple calls to party (and the list size is small).
    surveys_ids, business_ids = get_unique_survey_and_business_ids(enrolment_data)

    # This is a dictionary that will store all the data that is going to be cached instead of making multiple calls
    # inside the for loop for get_respondent_enrolments.
    cache_data = {"cases": dict()}
    redis_cache = RedisCache()

    # Populate the cache with all case data
    caching_case_data(cache_data, business_ids, tag)

    #  Populate the enrolments by creating a dictionary using the redis_cache
    collection_exercises = {
        survey_id: redis_cache.get_collection_exercises_by_survey(survey_id) for survey_id in surveys_ids
    }
    enrolments = get_respondent_enrolments_for_started_collex(enrolment_data, collection_exercises)

    for enrolment in enrolments:
        business_party = redis_cache.get_business_party(enrolment["business_id"])
        survey = redis_cache.get_survey(enrolment["survey_id"])

        # Note: If it ever becomes possible to get only live-but-not-ended collection exercises from the
        # collection exercise service, the filter_ended_collection_exercises function will no longer
        # be needed as we can request what we want instead of having to filter what we get.

        live_collection_exercises = filter_ended_collection_exercises(collection_exercises[enrolment["survey_id"]])

        collection_exercises_by_id = dict((ce["id"], ce) for ce in live_collection_exercises)
        cases_for_business = cache_data["cases"][business_party["id"]]

        # Gets all the cases for reporting unit, and by extension the user (because it's related to the business)
        enrolled_cases = [
            case
            for case in cases_for_business
            if case["caseGroup"]["collectionExerciseId"] in collection_exercises_by_id.keys()
        ]

        for case in enrolled_cases:
            collection_exercise = collection_exercises_by_id[case["caseGroup"]["collectionExerciseId"]]
            collection_instrument = redis_cache.get_collection_instrument(case["collectionInstrumentId"])
            collection_instrument_type = collection_instrument["type"]
            added_survey = True if business_party_id == business_party["id"] and survey_id == survey["id"] else None
            display_access_button = display_button(case["caseGroup"]["caseGroupStatus"], collection_instrument_type)

            yield {
                "case_id": case["id"],
                "status": case_controller.calculate_case_status(
                    case["caseGroup"]["caseGroupStatus"],
                    collection_instrument_type,
                ),
                "collection_instrument_type": collection_instrument_type,
                "survey_id": survey["id"],
                "survey_long_name": survey["longName"],
                "survey_short_name": survey["shortName"],
                "survey_ref": survey["surveyRef"],
                "business_party_id": business_party["id"],
                "business_name": business_party["name"],
                "trading_as": business_party["trading_as"],
                "business_ref": business_party["sampleUnitRef"],
                "period": collection_exercise["userDescription"],
                "submit_by": collection_exercise["events"]["return_by"]["date"],
                "formatted_submit_by": collection_exercise["events"]["return_by"]["formatted_date"],
                "due_in": collection_exercise["events"]["return_by"]["due_time"],
                "collection_exercise_ref": collection_exercise["exerciseRef"],
                "added_survey": added_survey,
                "display_button": display_access_button,
            }

def filter_ended_collection_exercises(collection_exercises: dict) -> list:
    """
    Takes the list of collection exercises and returns a list with all the ones that don't have a
    scheduledEndDateTime that is in the past. If a collection exercise is missing a scheduledEndDateTime
    attribute then it is also removed from the list.

    :param collection_exercises: A list of dictionaries containing collection exercises
    """
    return [
        ce
        for ce in collection_exercises
        if ce.get("scheduledEndDateTime")
        and parse(ce.get("scheduledEndDateTime")) > datetime.datetime.now(datetime.timezone.utc)
    ]

def get_case(cache_data, business_id, case_url, case_auth, tag):
    cache_data["cases"][business_id] = case_controller.get_cases_for_list_type_by_party_id(
        business_id, case_url, case_auth, tag
    )

def display_button(status, ci_type):
    return not (ci_type == "EQ" and status in CLOSED_STATE)

def is_respondent_enrolled(party_id: str, business_party_id: str, survey: dict) -> bool:
    respondent = get_respondent_party_by_id(party_id)
    enrolments = get_respondent_enrolments(respondent)
    for enrolment in enrolments:
        if enrolment["business_id"] == business_party_id and enrolment["survey_id"] == survey["id"]:
            return True
    return False

def notify_party_and_respondent_account_locked(respondent_id, email_address, status=None):
    bound_logger = logger.bind(respondent_id=respondent_id, email=obfuscate_email(email_address), status=status)
    bound_logger.info("Notifying respondent and party service that account is locked")
    url = f'{app.config["PARTY_URL"]}/party-api/v1/respondents/edit-account-status/{respondent_id}'

    data = {"respondent_id": respondent_id, "email_address": email_address, "status_change": status}

    response = requests.put(url, json=data, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        bound_logger.error("Failed to notify party")
        bound_logger.unbind("respondent_id", "email", "status")
        raise ApiError(logger, response)

    bound_logger.info("Successfully notified respondent and party service that account is locked")
    bound_logger.unbind("respondent_id", "email", "status")

def get_list_of_business_for_party(party_id: str) -> list:
    """
    Gets the details for the businesses associated with a respondent
    :param party_id: respondent party id
    :return: list of businesses
    """
    logger.info("Getting enrolment data for the party", party_id=party_id)
    respondent = get_respondent_party_by_id(party_id)
    enrolment_data = get_respondent_enrolments(respondent)
    business_ids = {enrolment["business_id"] for enrolment in enrolment_data}
    logger.info("Getting businesses against business ids", business_ids=business_ids, party_id=party_id)
    return get_business_by_id(business_ids)

def get_business_by_id(business_ids: list) -> list:
    """
    Gets the business details for all the business_id's that are provided (
    :param business_ids: This takes a single business id or a list of business ids
    :return: List of business
    """
    logger.info("Attempting to fetch businesses", business_ids=business_ids)
    params = {"id": business_ids}
    url = f'{app.config["PARTY_URL"]}/party-api/v1/businesses'
    response = requests.get(url, params=params, auth=app.config["BASIC_AUTH"])
    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        raise ApiError(logger, response)
    return response.json()

def get_surveys_listed_against_party_and_business_id(business_id: str, party_id: str) -> list:
    """
    returns list of surveys associated with a business id and respondent
    :param business_id: business id
    :param party_id: The respondent's party id
    :return: list of surveys
    """
    respondent = get_respondent_party_by_id(party_id)
    enrolment_data = get_respondent_enrolments(respondent)
    survey_ids = {enrolment["survey_id"] for enrolment in enrolment_data if enrolment["business_id"] == business_id}
    surveys = []
    for survey in survey_ids:
        response = survey_controller.get_survey(app.config["SURVEY_URL"], app.config["BASIC_AUTH"], survey)
        surveys.append(response)
    return surveys

def get_user_count_registered_against_business_and_survey(business_id: str, survey_id: str, is_transfer) -> int:
    """
    returns total number of users registered against a business and survey

    :param business_id: business id
    :param survey_id: The survey id
    :param is_transfer: True if the request is for transfer survey
    :return: total number of users
    """
    logger.info("Attempting to get user count", business_ids=business_id, survey_id=survey_id)
    url = f'{app.config["PARTY_URL"]}/party-api/v1/pending-survey-users-count'
    data = {"business_id": business_id, "survey_id": survey_id, "is_transfer": is_transfer}
    response = requests.get(url, params=data, auth=app.config["BASIC_AUTH"])
    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        raise ApiError(logger, response)
    return response.json()

def register_pending_shares(payload):
    """
    register new entries to party for pending shares

    :param payload: pending shares entries dict
    :return: success if post completed
    :rtype: response object
    """
    logger.info("Attempting register pending shares")
    url = f'{app.config["PARTY_URL"]}/party-api/v1/pending-surveys'
    response = requests.post(url, json=json.loads(payload), auth=app.config["BASIC_AUTH"])
    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        if response.status_code == 400:
            logger.info("share survey has already been shared, hence ignoring this request.")
        else:
            raise ApiError(logger, response)
    return response

def get_pending_surveys_batch_number(batch_no):
    """
    Gets batch number for the shared survey

    :param batch_no: Shared survey batch number
    :type batch_no: str
    :raises ApiError: Raised when party returns api error
    :return: list share surveys
    """
    logger.info("Attempting to retrieve share surveys by batch number", batch_no=batch_no)
    url = f"{app.config['PARTY_URL']}/party-api/v1/pending-surveys/{batch_no}"
    response = requests.get(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to retrieve share surveys by batch number", batch_no=batch_no)
        raise ApiError(logger, response)

    logger.info("Successfully retrieved share surveys by batch number", batch_no=batch_no)
    return response

def create_pending_survey_account(registration_data):
    """
    Gives call to party service to create a new account and register the account against the email address of share
    surveys/ transfer surveys
    :param registration_data: respondent details
    :type registration_data: dict
    :raises ApiError: Raised when party returns api error
    """
    logger.info("Attempting to create new account against share survey")

    url = f"{app.config['PARTY_URL']}/party-api/v1/pending-survey-respondent"
    registration_data["status"] = "ACTIVE"
    response = requests.post(url, auth=app.config["BASIC_AUTH"], json=registration_data)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        if response.status_code == 400:
            logger.info("Email has already been used")
        else:
            logger.error("Failed to create account")
        raise ApiError(logger, response)

    logger.info("Successfully created account")

def get_business_by_ru_ref(ru_ref: str):
    """
    Gives call to party service to retrieve a business using a ru_ref parameter
    :param ru_ref: the reporting unit reference
    :returns: a business
    :raises ApiError: Raised when party returns api error
    """
    logger.info("Attempting to retrieve business by ru_ref", ru_ref=ru_ref)

    url = f"{app.config['PARTY_URL']}/party-api/v1/businesses/ref/{ru_ref}"
    response = requests.get(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error("Failed to retrieve business by ru_ref", ru_ref=ru_ref)
        raise ApiError(logger, response)

    logger.info("Successfully retrieved business by ru_ref", ru_ref=ru_ref)

    return response.json()

def get_verification_token(party_id):
    """
    Gives call to party service to retrieve a verification token for the respondent
    :param party_id: the respondent's id
    :returns: verification token
    """
    logger.info("Attempting to retrieve respondent verification token", party_id=party_id)
    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/{party_id}/password-verification-token"
    response = requests.get(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.HTTPError:
        if response == 404:
            logger.error("Verification token not found")
            raise NotFound("Token not found")
        logger.error("Failed to retrieve verification token", party_id=party_id)
        raise ApiError(logger, response)

    logger.info("Successfully retrieved verification token")

    return response.json()

def post_verification_token(email, token):
    """
    Gives call to party service to add a verification token for the respondent and increase the password reset counter
    :param email: the respondent's email
    :param token: the verification token
    """
    logger.info(
        "Attempting to add respondent verification token and increase password reset counter",
        email=obfuscate_email(email),
    )

    party_id = get_respondent_by_email(email)["id"]
    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/{party_id}/password-verification-token"
    payload = {
        "token": token,
    }
    response = requests.post(url, auth=app.config["BASIC_AUTH"], json=payload)

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        logger.error(
            "Failed to add respondent verification token or increase password reset counter",
            email=obfuscate_email(email),
        )
        raise ApiError(logger, response)

    logger.info(
        "Successfully added respondent verification token and password reset counter", email=obfuscate_email(email)
    )

    return response.json()

def delete_verification_token(token):
    """
    Gives call to party service to delete a verification token for the respondent
    :param token: the verification token
    """
    email = decode_email_token(token)
    logger.info("Attempting to delete respondent verification token", email=obfuscate_email(email))

    party_id = get_respondent_by_email(email)["id"]
    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/{party_id}/password-verification-token/{token}"
    response = requests.delete(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        if response.status_code == 404:
            logger.error("Verification token not found")
            raise NotFound("Token not found")
        logger.error("Failed to delete respondent verification token", email=obfuscate_email(email))
        raise ApiError(logger, response)

    logger.info("Successfully deleted respondent verification token", email=obfuscate_email(email))

    return response.json()

def get_password_reset_counter(party_id):
    """
    Gives call to the party service to retrieve the password reset counter for the respondent
    :param party_id: the respondent's id
    :returns: current number of password reset attempts
    """

    logger.info("Attempting to retrieve respondent password reset counter", party_id=party_id)
    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/{party_id}/password-reset-counter"
    response = requests.get(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        if response.status_code == 404:
            logger.error("Counter not found")
            raise NotFound("Counter not found")
        logger.error("Failed to retrieve password reset counter", party_id=party_id)
        raise ApiError(logger, response)

    logger.info("Successfully retrieved password reset counter")
    return response.json()

def reset_password_reset_counter(party_id):
    """
    Gives call to the party service to reset the password reset counter for the respondent
    :param party_id: the respondent's id
    """

    logger.info("Attempting to reset respondent password reset counter", party_id=party_id)
    url = f"{app.config['PARTY_URL']}/party-api/v1/respondents/{party_id}/password-reset-counter"
    response = requests.delete(url, auth=app.config["BASIC_AUTH"])

    try:
        response.raise_for_status()
    except requests.exceptions.HTTPError:
        if response.status_code == 404:
            logger.error("Counter not found")
            raise NotFound("Counter not found")
        logger.error("Failed to reset password reset counter", party_id=party_id)
        raise ApiError(logger, response)

    logger.info("Successfully reset password reset counter")
    return response.json()