// Post the information of file and get the information of upload destination.
770045
func (pb *Pushbullet) PostUploadRequest(name, mime string) (*responses.Upload, error) {
	res, err := pb.postUploadRequest(name, mime)
	if err != nil {
		return nil, err
	}

	// TODO: Return an error value with human friendly message.
	if res.StatusCode != 200 {
		return nil, errors.New(res.Status)
	}

	decoder := json.NewDecoder(res.Body)

	var upload *responses.Upload
	if err := decoder.Decode(&upload); err != nil {
		return nil, err
	}

	return upload, nil
}
1218828
func (d *DirectoryUploader) Upload(upload UploadFn) error {
	return filepath.Walk(d.Dir, func(path string, f os.FileInfo, err error) error {
		if err != nil {
			return err
		}
		if f.IsDir() {
			return nil
		}
		file, err := Open(path)
		if err != nil {
			return err
		}
		relPath, err := filepath.Rel(d.Dir, path)
		if err != nil {
			return err
		}
		file.Path = filepath.ToSlash(relPath)
		return upload(file)
	})
}
648410
func (g *Group) Post(path string, h HandlerFunc, opts ...HandlerOption) {
	g.add(path, h, opts, http.MethodPost)
}
977084
func (srv *Server) Post(path string, body []byte) *Request {
	return srv.NewRequest(http.MethodPost, path).Body(body)
}
904258
func (this *HttpClient) Post(url string, params interface{}) (*Response,
	error) {
	paramsValues := toUrlValues(params)
	// Post with files should be sent as multipart.
	if checkParamFile(paramsValues) {
		return this.PostMultipart(url, params)
	}

	headers := make(map[string]string)
	headers["Content-Type"] = "application/x-www-form-urlencoded"
	body := strings.NewReader(paramsValues.Encode())

	return this.Do("POST", url, headers, body)
}
1279138
func (r *Router) Post(path string, handler HandlerFunc) {
	r.Add(POST, path, handler)
}
322766
func (sem *Sem) Post() error {
	ret := int(C.SDL_SemPost(sem.cptr()))
	if ret != 0 {
		return GetError()
	}
	return nil
}
534941
func (s *Server) Post(path string, h HandlerFunc, opts ...HandlerOption) {
	s.register(http.MethodPost, path, h, opts...)
}
522589
func Post(destination string, stats []Sample) error {
	payload := map[string][]Sample{"metrics": stats}
	data, err := json.Marshal(payload)
	if err != nil {
		plog.WithField("numstats", len(stats)).WithError(err).
			Warn("Unable to convert internal metrics to JSON for posting to OpenTSDB")
		return nil
	}
	statsReq, err := http.NewRequest("POST", destination, bytes.NewBuffer(data))
	if err != nil {
		plog.WithFields(logrus.Fields{
			"destination": destination,
		}).WithError(err).Warn("Couldn't create stats request")
		return nil
	}
	statsReq.Header["User-Agent"] = statsReqUserAgent
	statsReq.Header["Content-Type"] = statsReqContentType
	resp, err := http.DefaultClient.Do(statsReq)
	if err != nil {
		plog.WithField("reqHeader", statsReq.Header).WithError(err).
			Debug("Couldn't post container stats")
		return err
	}
	defer resp.Body.Close()
	if !strings.Contains(resp.Status, "200 OK") {
		plog.WithFields(logrus.Fields{
			"status":    resp.Status,
			"reqHeader": statsReq.Header,
		}).Debug("Non-Success response when posting stats")
		return fmt.Errorf("stats: Received response status: \"%s\" from metric POST",
			resp.Status)
	}
	return nil
}
256700
func Upload(file *os.File, bucket, key string) error {
	uploader := s3manager.NewUploader(session.New(&aws.Config{Region: aws.String("us-east-1")}))
	result, err := uploader.Upload(&s3manager.UploadInput{
		Body:   file,
		Bucket: aws.String(bucket),
		Key:    aws.String(key),
	})
	if err != nil {
		return err
	}
	log.Println("Successfully uploaded to", result.Location)
	return nil
}
284656
func (c *Client) Post(ctx context.Context, route string, queryParams ...string) error {
	return c.PostWithBody(ctx, route, nil, queryParams...)
}
1245698
func (g *routeGroup) Post(path string, h ...Handler) {
	g.handle(POST, path, h)
}
555091
func Post(message string, photos ...vkutil.Photo) (int, error) {
	api.VkApi.AccessToken = setting.VkAccessToken

	api.SetDebug(true)

	params := url.Values{}
	if len(photos) > 0 {
		att := []string{}
		for _, v := range photos {
			att = append(att, getPhotoString(v.Id, v.OwnerId))
		}
		params.Set("attachments", strings.Join(att, ","))
	}

	return api.WallPost(vkutil.OptsWallPost{
		OwnerId:   -setting.VkGroupID,
		Message:   message,
		FromGroup: true,
	}, params)
}
967939
func (e *Expect) POST(path string, pathargs ...interface{}) *Request {
	return e.Request("POST", path, pathargs...)
}
1019115
func (r *Router) Post(path string, fn interface{}) *Router {
	return r.addRoute(httpMethodPost, path, fn)
}
1358410
func (s *Sling) Post(pathURL string) *Sling {
	s.method = "POST"
	return s.Path(pathURL)
}
1183257
func Upload(client *http.Client, upload *responses.Upload, reader io.Reader) error {
	req, err := createUploadReq(upload, reader)
	if err != nil {
		return err
	}

	res, err := client.Do(req)
	if err != nil {
		return err
	}

	// TODO: Return an error value with human friendly message.
	if res.StatusCode < 200 || 300 <= res.StatusCode {
		return errors.New(res.Status)
	}

	return nil
}