1 <?php
2 /**
3 * Copyright 2019 Klarna AB
4 *
5 * Licensed under the Apache License, Version 2.0 (the "License");
6 * you may not use this file except in compliance with the License.
7 * You may obtain a copy of the License at
8 *
9 * http://www.apache.org/licenses/LICENSE-2.0
10 *
11 * Unless required by applicable law or agreed to in writing, software
12 * distributed under the License is distributed on an "AS IS" BASIS,
13 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14 * See the License for the specific language governing permissions and
15 * limitations under the License.
16 *
17 * File containing the UserAgent interface.
18 */
19
20 namespace Klarna\Rest\Transport;
21
22 /**
23 * The user agent is used to help identify the client and provide additional
24 * information when assistance is needed with troubleshooting.
25 *
26 * In addition to following the User Agent as specified by RFC 2616, section 14.43,
27 * there are a number of predefined fields which should be used when applicable:
28 *
29 * Library:
30 * Information about the SDK and version being used.
31 *
32 * Library/[Library name]_[version]
33 *
34 * Examples:
35 * Library/Klarna.SDK_1.0.0
36 *
37 *
38 * Language:
39 * This is used to indicate which programming language and version is being used.
40 *
41 * Language/[Language]_[version]
42 *
43 * Example:
44 * Language/PHP_5.5.9-1ubuntu4.4
45 *
46 *
47 * OS:
48 * Information on what operating system the merchant is using for their web server.
49 *
50 * OS/[Operating system]_[version and architecture]
51 *
52 * Examples:
53 * OS/Linux_3.13.5-101.fc19.x86_64
54 *
55 *
56 * Partner:
57 * This is used to indicate if the integration is done using a partner.
58 *
59 * Partner/[Partner name]
60 *
61 * Examples:
62 * Partner/ShopPartnerName
63 *
64 *
65 * Platform:
66 * Information about which e-commerce platform is used to integrate.
67 *
68 * Platform/[Platform name]_[version]
69 *
70 * Examples:
71 * Platform/Magento_1.2.3
72 * Platform/Opencart_1.5.6.4
73 *
74 *
75 * Module:
76 * Used in conjunction with platform to provide information about the platform
77 * plugin.
78 *
79 * Module/[Module name]_[version]
80 *
81 * Examples:
82 * Module/Klarna.Module_1.0.0
83 *
84 *
85 * Webserver:
86 * Information about the web server being used.
87 *
88 * Webserver/[Webserver name]_[version]
89 *
90 * Examples:
91 * Webserver/Apache_2.4.1
92 * Webserver/Nginx_1.7.6
93 * Webserver/IIS_7.5
94 *
95 *
96 * Each component is written as key and name separated by slash, optionally followed
97 * by an underscore and the version. After which, separated by space, additional
98 * information can be added using parenthesis where individual elements inside are
99 * separated by semi-colon.
100 *
101 * All of the component strings are then combined using space as the delimiter.
102 *
103 * Specifying SDK dependencies for the Library field could be achieved as follows:
104 * Library/Klarna.SDK_1.0.0 (Guzzle/4.2.2 ; curl/7.35.0)
105 *
106 * Full user agent example:
107 * Library/Klarna.SDK_1.0.0 Language/PHP_5.5.9 OS/Linux_3.13.5-101.fc19.x86_64
108 */
109 interface UserAgentInterface
110 {
111 /**
112 * Serialises the user agent.
113 *
114 * @return string
115 */
116 public function __toString();
117 }
118