blob: 53b51fcc0d7ae9540ae2a474624fd2a47af764c0 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
<?php
namespace OpenCloud\Common\Resource;
use Psr\Http\Message\ResponseInterface;
interface HasMetadata
{
/**
* Retrieves the metadata for the resource in the form of an associative array or hash. Each key represents the
* metadata item's name, and each value represents the metadata item's remote value.
*
* @return array
*/
public function getMetadata();
/**
* Merges a set of new values with those which already exist (on the remote API) for a resource. For example, if
* the resource has this metadata already set:
*
* Foo: val1
* Bar: val2
*
* and mergeMetadata(['Foo' => 'val3', 'Baz' => 'val4']); is called, then the resource will have the following
* metadata:
*
* Foo: val3
* Bar: val2
* Baz: val4
*
* You will notice that any metadata items which are not specified in the call are preserved.
*
* @param array $metadata The new metadata items
*
* @return mixed
*/
public function mergeMetadata(array $metadata);
/**
* Replaces all of the existing metadata items for a resource with a new set of values. Any metadata items which
* are not provided in the call are removed from the resource. For example, if the resource has this metadata
* already set:
*
* Foo: val1
* Bar: val2
*
* and resetMetadata(['Foo' => 'val3', 'Baz' => 'val4']); is called, then the resource will have the following
* metadata:
*
* Foo: val3
* Baz: val4
*
* @param array $metadata The new metadata items
*
* @return mixed
*/
public function resetMetadata(array $metadata);
/**
* Extracts metadata from a response object and returns it in the form of an associative array.
*
* @param ResponseInterface $response
*
* @return array
*/
public function parseMetadata(ResponseInterface $response);
}
|