// NewInteraction constructs an interaction with the given prompt, limited to
// the given choices, if any.
//
// Defaults Input and Output to os.Stdin and os.Stderr, respectively.
428616
func NewInteraction(prompt string, choices ...Choice) Interaction {
	return Interaction{
		Input:   os.Stdin,
		Output:  os.Stdout,
		Prompt:  prompt,
		Choices: choices,
	}
}
900456
func NewConversation(match allot.MatchInterface, msg Message, socket *websocket.Conn) ConversationInterface {
	conv := &Conversation{
		message: msg,
		match:   match,
		socket:  socket,
	}

	conv.SetConnection(websocket.JSON)

	return conv
}
857598
func NewConnection(host string, port string) *Connection {
	return &Connection{host, port, http.DefaultClient}
}
698048
func NewMockEventInterface(ctrl *gomock.Controller) *MockEventInterface {
	mock := &MockEventInterface{ctrl: ctrl}
	mock.recorder = &MockEventInterfaceMockRecorder{mock}
	return mock
}
80858
func NewPutStr(ctx context.Context, table, key string,
	values map[string]map[string][]byte, options ...func(Call) error) (*Mutate, error) {
	return NewPut(ctx, []byte(table), []byte(key), values, options...)
}
742624
func newInfoCommand(m *Main) *InfoCommand {
	return &InfoCommand{
		Stdin:  m.Stdin,
		Stdout: m.Stdout,
		Stderr: m.Stderr,
	}
}
472031
func NewIDGenerator(s string, t *testing.T) IDGenerator {
	return IDGenerator{
		IDFn: func() platform.ID {
			id, err := platform.IDFromString(s)
			if err != nil {
				t.Fatal(err)
			}
			return *id
		},
	}
}
993990
func newInterface(nlh *netlink.Handle, config *networkConfiguration) (*bridgeInterface, error) {
	var err error
	i := &bridgeInterface{nlh: nlh}

	// Initialize the bridge name to the default if unspecified.
	if config.BridgeName == "" {
		config.BridgeName = DefaultBridgeName
	}

	// Attempt to find an existing bridge named with the specified name.
	i.Link, err = nlh.LinkByName(config.BridgeName)
	if err != nil {
		logrus.Debugf("Did not find any interface with name %s: %v", config.BridgeName, err)
	} else if _, ok := i.Link.(*netlink.Bridge); !ok {
		return nil, fmt.Errorf("existing interface %s is not a bridge", i.Link.Attrs().Name)
	}
	return i, nil
}
908334
func PasswordKeyboardInteractive(password string) ssh.KeyboardInteractiveChallenge {
	return func(user, instruction string, questions []string, echos []bool) ([]string, error) {
		log.Printf("Keyboard interactive challenge: ")
		log.Printf("-- User: %s", user)
		log.Printf("-- Instructions: %s", instruction)
		for i, question := range questions {
			log.Printf("-- Question %d: %s", i+1, question)
		}

		// Just send the password back for all questions
		answers := make([]string, len(questions))
		for i := range answers {
			answers[i] = string(password)
		}

		return answers, nil
	}
}
121642
func NewConnection(connection net.Conn, context Context) *Connection {
	conn := &Connection{
		connection: connection,
		context:    context,
	}

	// Setup new session for the connection
	session := NewSession(conn)
	context.SetSessionForConnection(session, conn)

	return conn
}
285529
func newInterface(c context.Context) config.Interface {
	s, err := gaeconfig.FetchCachedSettings(c)
	if err != nil {
		panic(err)
	}
	t, err := auth.GetRPCTransport(c, auth.AsSelf)
	if err != nil {
		panic(err)
	}
	return remote.New(s.ConfigServiceHost, false, func(c context.Context) (*http.Client, error) {
		return &http.Client{Transport: t}, nil
	})
}
473791
func NewConnection(address string, port int,
	timeout time.Duration) (*Connection, error) {

	url := "http://" + address + ":" + strconv.Itoa(port)
	return createConnection(url, timeout)
}
846299
func (s *Simulator) NewConnection() *Connection {
	addr := s.LocalAddr()
	return &Connection{
		Hostname:  addr.IP.String(),
		Port:      addr.Port,
		Interface: "lan",
	}
}
257538
func NewMain() *Main {
	return &Main{
		Stdin:  os.Stdin,
		Stdout: os.Stdout,
		Stderr: os.Stderr,
	}
}
1261505
func (session *ProxySession) CreateInteraction(participantSid string, msg ProxyMessage) (response Interaction, exception *Exception, err error) {
	if msg.Body == "" {
		return response, exception, errors.New("Message Body Must exist")
	}

	twilioUrl := fmt.Sprintf("%s/%s/%s/%s/%s/%s/%s/%s", ProxyBaseUrl, "Services", session.ServiceSid, "Sessions", session.Sid, "Participants", participantSid, "MessageInteractions")

	formValues := url.Values{}
	formValues.Set("Body", msg.Body)

	if msg.MediaUrl != "" {
		formValues.Set("MediaUrl", msg.MediaUrl)
	}
	if msg.Callback != "" {
		formValues.Set("Callback", msg.Callback)
	}

	res, err := session.twilio.post(formValues, twilioUrl)
	if err != nil {
		return response, exception, err
	}
	defer res.Body.Close()

	responseBody, err := ioutil.ReadAll(res.Body)
	if err != nil {
		return response, exception, err
	}

	if res.StatusCode != http.StatusOK {
		exception = new(Exception)
		err = json.Unmarshal(responseBody, exception)

		// We aren't checking the error because we don't actually care.
		// It's going to be passed to the client either way.
		return response, exception, err
	}

	err = json.Unmarshal(responseBody, &response)
	return response, exception, err
}
1245010
func (c *Client) NewConversation() *ClientConversation {
	c.RLock()
	defer c.RUnlock()
	return &ClientConversation{
		client:   c,
		nonceGen: c.nonceGen,
		hashGen:  c.hashGen,
		minIters: c.minIters,
	}
}
650823
func New(opts *Options) *Client {
	// Initialize the options.
	if opts == nil {
		opts = &Options{}
	}
	// Create a Client.
	cli := &Client{
		disconnc:     make(chan struct{}, 1),
		disconnEndc:  make(chan struct{}),
		errorHandler: opts.ErrorHandler,
	}

	// Launch a goroutine which disconnects the Network Connection.
	cli.wg.Add(1)
	go func() {
		defer func() {
			cli.wg.Done()
		}()

		for {
			select {
			case <-cli.disconnc:
				if err := cli.Disconnect(); err != nil {
					if cli.errorHandler != nil {
						cli.errorHandler(err)
					}
				}
			case <-cli.disconnEndc:
				// End the goroutine.
				return
			}
		}

	}()

	// Return the Client.
	return cli
}