~ballot/wordpress/openstack-objectstorage-breaking-insight

« back to all changes in this revision

Viewing changes to vendor/guzzlehttp/guzzle/src/Post/PostBodyInterface.php

  • Committer: Jacek Nykis
  • Date: 2015-02-11 15:35:31 UTC
  • Revision ID: jacek.nykis@canonical.com-20150211153531-hmy6zi0ov2qfkl0b
Initial commit

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
 
 
3
namespace GuzzleHttp\Post;
 
4
 
 
5
use GuzzleHttp\Message\RequestInterface;
 
6
use GuzzleHttp\Stream\StreamInterface;
 
7
 
 
8
/**
 
9
 * Represents a POST body that is sent as either a multipart/form-data stream
 
10
 * or application/x-www-urlencoded stream.
 
11
 */
 
12
interface PostBodyInterface extends StreamInterface, \Countable
 
13
{
 
14
    /**
 
15
     * Apply headers to the request appropriate for the current state of the object
 
16
     *
 
17
     * @param RequestInterface $request Request
 
18
     */
 
19
    public function applyRequestHeaders(RequestInterface $request);
 
20
 
 
21
    /**
 
22
     * Set a specific field
 
23
     *
 
24
     * @param string       $name  Name of the field to set
 
25
     * @param string|array $value Value to set
 
26
     *
 
27
     * @return $this
 
28
     */
 
29
    public function setField($name, $value);
 
30
 
 
31
    /**
 
32
     * Set the aggregation strategy that will be used to turn multi-valued
 
33
     * fields into a string.
 
34
     *
 
35
     * The aggregation function accepts a deeply nested array of query string
 
36
     * values and returns a flattened associative array of key value pairs.
 
37
     *
 
38
     * @param callable $aggregator
 
39
     */
 
40
    public function setAggregator(callable $aggregator);
 
41
 
 
42
    /**
 
43
     * Set to true to force a multipart upload even if there are no files.
 
44
     *
 
45
     * @param bool $force Set to true to force multipart uploads or false to
 
46
     *     remove this flag.
 
47
     *
 
48
     * @return self
 
49
     */
 
50
    public function forceMultipartUpload($force);
 
51
 
 
52
    /**
 
53
     * Replace all existing form fields with an array of fields
 
54
     *
 
55
     * @param array $fields Associative array of fields to set
 
56
     *
 
57
     * @return $this
 
58
     */
 
59
    public function replaceFields(array $fields);
 
60
 
 
61
    /**
 
62
     * Get a specific field by name
 
63
     *
 
64
     * @param string $name Name of the POST field to retrieve
 
65
     *
 
66
     * @return string|null
 
67
     */
 
68
    public function getField($name);
 
69
 
 
70
    /**
 
71
     * Remove a field by name
 
72
     *
 
73
     * @param string $name Name of the field to remove
 
74
     *
 
75
     * @return $this
 
76
     */
 
77
    public function removeField($name);
 
78
 
 
79
    /**
 
80
     * Returns an associative array of names to values or a query string.
 
81
     *
 
82
     * @param bool $asString Set to true to retrieve the fields as a query
 
83
     *     string.
 
84
     *
 
85
     * @return array|string
 
86
     */
 
87
    public function getFields($asString = false);
 
88
 
 
89
    /**
 
90
     * Returns true if a field is set
 
91
     *
 
92
     * @param string $name Name of the field to set
 
93
     *
 
94
     * @return bool
 
95
     */
 
96
    public function hasField($name);
 
97
 
 
98
    /**
 
99
     * Get all of the files
 
100
     *
 
101
     * @return array Returns an array of PostFileInterface objects
 
102
     */
 
103
    public function getFiles();
 
104
 
 
105
    /**
 
106
     * Get a POST file by name.
 
107
     *
 
108
     * @param string $name Name of the POST file to retrieve
 
109
     *
 
110
     * @return PostFileInterface|null
 
111
     */
 
112
    public function getFile($name);
 
113
 
 
114
    /**
 
115
     * Add a file to the POST
 
116
     *
 
117
     * @param PostFileInterface $file File to add
 
118
     *
 
119
     * @return $this
 
120
     */
 
121
    public function addFile(PostFileInterface $file);
 
122
 
 
123
    /**
 
124
     * Remove all files from the collection
 
125
     *
 
126
     * @return $this
 
127
     */
 
128
    public function clearFiles();
 
129
}