// ReplyFor returns reply message for given request message name.
183483
func (a *VppAdapter) ReplyFor(requestMsgName string) (api.Message, uint16, bool) {
	replType, msgID, foundReplType := a.ReplyTypeFor(requestMsgName)
	if foundReplType {
		msgVal := reflect.New(replType)
		if msg, ok := msgVal.Interface().(api.Message); ok {
			log.Println("FFF ", replType, msgID, foundReplType)
			return msg, msgID, true
		}
	}

	return nil, 0, false
}
324492
func (o OAuthSession) Reply(r Replier, comment string) (*Comment, error) {
	// Build form for POST request.
	form := url.Values{
		"api_type": {"json"},
		"thing_id": {r.replyID()},
		"text":     {comment},
	}

	type response struct {
		JSON struct {
			Errors [][]string
			Data   struct {
				Things []struct {
					Data map[string]interface{}
				}
			}
		}
	}

	res := &response{}

	err := o.postBody("https://oauth.reddit.com/api/comment", form, res)
	if err != nil {
		return nil, err
	}

	if len(res.JSON.Errors) != 0 {
		var msg []string
		for _, k := range res.JSON.Errors {
			msg = append(msg, k[1])
		}
		return nil, errors.New(strings.Join(msg, ", "))
	}

	c := makeComment(res.JSON.Data.Things[0].Data)

	return c, nil
}
637998
func (this *Weixinmp) ReplyMusicMsg(rw http.ResponseWriter, music *Music) error {
	var msg musicMsg
	msg.MsgType = "music"
	msg.Music = music
	return this.replyMsg(rw, &msg)
}
1369570
func replyWithJSON(w http.ResponseWriter, obj interface{}) error {
	w.Header().Set("Content-Type", "application/json; charset=utf-8")
	w.WriteHeader(http.StatusOK)
	enc := json.NewEncoder(w)
	enc.SetIndent("", "  ")
	enc.SetEscapeHTML(false)
	return enc.Encode(obj)
}
442991
func (c Command) ReplyAssign(receiver string, d Domain) string {
	var args []string
	for _, arg := range c.Returns {
		name := arg.Name(d)
		if name == "range" || name == "type" {
			name = name[0 : len(name)-1]
		}
		args = append(args, name+" = "+receiver+"."+arg.ExportedName(d))
	}
	return strings.Join(args, "\n")
}
664858
func ResponseFor(mapper api.UserIdentityMapper, identity api.UserIdentityInfo) (*authenticator.Response, bool, error) {
	user, err := mapper.UserFor(identity)
	if err != nil {
		logf("error creating or updating mapping for: %#v due to %v", identity, err)
		return nil, false, err
	}
	logf("got userIdentityMapping: %#v", user)

	// only set User field as IDPs have no concept of Audiences
	return &authenticator.Response{User: user}, true, nil
}
1234306
func ForwardResponseMessage(ctx context.Context, mux *ServeMux, marshaler Marshaler, w http.ResponseWriter, req *http.Request, resp proto.Message, opts ...func(context.Context, http.ResponseWriter, proto.Message) error) {
	md, ok := ServerMetadataFromContext(ctx)
	if !ok {
		grpclog.Infof("Failed to extract ServerMetadata from context")
	}

	handleForwardResponseServerMetadata(w, mux, md)
	handleForwardResponseTrailerHeader(w, md)

	contentType := marshaler.ContentType()
	// Check marshaler on run time in order to keep backwards compatability
	// An interface param needs to be added to the ContentType() function on 
	// the Marshal interface to be able to remove this check
	if httpBodyMarshaler, ok := marshaler.(*HTTPBodyMarshaler); ok {
		contentType = httpBodyMarshaler.ContentTypeFromMessage(resp)
	}
	w.Header().Set("Content-Type", contentType)

	if err := handleForwardResponseOptions(ctx, w, resp, opts); err != nil {
		HTTPError(ctx, mux, marshaler, w, req, err)
		return
	}
	var buf []byte
	var err error
	if rb, ok := resp.(responseBody); ok {
		buf, err = marshaler.Marshal(rb.XXX_ResponseBody())
	} else {
		buf, err = marshaler.Marshal(resp)
	}
	if err != nil {
		grpclog.Infof("Marshal error: %v", err)
		HTTPError(ctx, mux, marshaler, w, req, err)
		return
	}

	if _, err = w.Write(buf); err != nil {
		grpclog.Infof("Failed to write response: %v", err)
	}

	handleForwardResponseTrailer(w, md)
}
503401
func (p *peer) ReplyHelperTrieProofs(reqID uint64, resp HelperTrieResps) *reply {
	data, _ := rlp.EncodeToBytes(resp)
	return &reply{p.rw, HelperTrieProofsMsg, reqID, data}
}
485928
func (sp *SendAudio) ReplyToMessage(rm int) *SendAudio {
	sp.ReplyToMessageID = &rm
	return sp
}
709850
func (fw *Framework) NewReplyFromMessage(version string, msg *Message) (rep protocol.Reply, err error) {
	if msg.Type() != "reply" {
		err = fmt.Errorf("Cannot use `%s` message to construct a Reply", msg.Type())
		return
	}

	if msg.Request == nil {
		err = fmt.Errorf("Cannot create a Reply from Messages without Requests")
		return
	}

	req, err := fw.NewRequestFromMessage(version, msg.Request)
	if err != nil {
		return
	}

	rep, err = fw.NewReply(req)
	rep.SetMessage(msg.Payload)

	return
}
783790
func (sp *SendLocation) ReplyToMessage(rm int) *SendLocation {
	sp.ReplyToMessageID = &rm
	return sp
}
1361898
func (r *Packet) Reply(payload interface{}, err error) ([]byte, error) {
	p := new(Packet)

	status := uint32(StatusSuccess)

	if err != nil {
		status = errorStatus(err)
	} else {
		p.Payload, err = MarshalBinary(payload)
		if err != nil {
			return nil, err
		}
	}

	p.Header = Header{
		Version:     HeaderVersion,
		Dummy:       OpNewHeader,
		PacketSize:  headerSize + uint32(len(p.Payload)),
		HeaderSize:  headerSize,
		RequestID:   r.RequestID,
		Op:          r.Op,
		Status:      status,
		Flags:       PacketFlagReply,
		Information: 0,
		SessionID:   r.SessionID,
	}

	if Trace {
		rc := "OK"
		if err != nil {
			rc = err.Error()
		}
		fmt.Fprintf(os.Stderr, "[hgfs] response %#v [%s]\n", p.Header, rc)
	} else if err != nil {
		log.Printf("[hgfs] op=%d error: %s", r.Op, err)
	}

	return p.MarshalBinary()
}
307329
func PutReplyEncoder(enc Encoding, e ReplyEncoder) {
	if enc == EncodingJSON {
		jsonReplyEncoderPool.Put(e)
	}
	protobufReplyEncoderPool.Put(e)
}
1260875
func replyError(c context.Context, rw http.ResponseWriter, err error) {
	if transient.Tag.In(err) {
		rw.WriteHeader(http.StatusInternalServerError)
	} else {
		rw.WriteHeader(http.StatusBadRequest)
	}
	templates.MustRender(c, rw, "pages/error.html", templates.Args{
		"Error": err.Error(),
	})
}
538537
func (client *Client) ReplyMessage(replyToken string, messages ...SendingMessage) *ReplyMessageCall {
	return &ReplyMessageCall{
		c:          client,
		replyToken: replyToken,
		messages:   messages,
	}
}
818603
func ReplyOk(message ...string) *Reply {
	if len(message) == 0 {
		message = []string{"Ok"}
	}
	return &Reply{250, message, nil}
}
100849
func (b *Bot) ReplyWithAttachments(evt *slack.MessageEvent, attachments []slack.Attachment, typing bool) {
	params := slack.PostMessageParameters{AsUser: true}
	params.Attachments = attachments

	b.Client.PostMessage(evt.Msg.Channel, "", params)
}