@@ -54,43 +54,78 @@ function fetchByMember(int $resource_id, int $member_id): APIResponse {
54
54
}
55
55
56
56
/**
57
- * Issue a new resource license.
57
+ * Issue a new permanent resource license.
58
+ *
59
+ * @param int The identifier of the resource.
60
+ * @param int The identifier of the member.
61
+ * @param bool Whether or not the license should be active.
62
+ *
63
+ * @return APIResponse The parsed API response.
64
+ */
65
+ function issuePermanent (int $ resource_id , int $ member_id , bool $ active ): APIResponse {
66
+ $ body = [
67
+ "purchaser_id " => $ member_id ,
68
+ "permanent " => true ,
69
+ "active " => $ active
70
+ ];
71
+
72
+ return $ this ->wrapper ->post (sprintf ("resources/%d/licenses " , $ resource_id ), $ body );
73
+ }
74
+
75
+ /**
76
+ * Issue a new temporary resource license.
58
77
*
59
78
* @param int The identifier of the resource.
60
79
* @param int The identifier of the member.
61
80
* @param int The start date of the license as a UNIX timestamp.
62
81
* @param int The end date of the license as a UNIX timestamp.
63
- * @param bool Whether or not the license should be active.
64
82
*
65
83
* @return APIResponse The parsed API response.
66
84
*/
67
- function issue (int $ resource_id , int $ member_id , int $ start_date , int $ end_date, bool $ active ): APIResponse {
85
+ function issueTemporary (int $ resource_id , int $ member_id , int $ start_date , int $ end_date ): APIResponse {
68
86
$ body = [
69
87
"purchaser_id " => $ member_id ,
88
+ "permanent " => false ,
70
89
"start_date " => $ start_date ,
71
- "end_date " => $ end_date ,
72
- "active " => $ active
90
+ "end_date " => $ end_date
73
91
];
74
92
75
93
return $ this ->wrapper ->post (sprintf ("resources/%d/licenses " , $ resource_id ), $ body );
76
94
}
77
95
78
96
/**
79
- * Modify an existing resource license.
97
+ * Modify a permanent license (and convert to permanent if currently temporary).
98
+ *
99
+ * @param int The identifier of the resource.
100
+ * @param int The identifier of the license.
101
+ * @param bool Whether or not the license should be active, or null if unchanged.
102
+ *
103
+ * @return APIResponse The parsed API response.
104
+ */
105
+ function modifyPermanent (int $ resource_id , int $ license_id , bool $ active ): APIResponse {
106
+ $ body = [
107
+ "permanent " => false ,
108
+ "active " => $ active
109
+ ];
110
+
111
+ return $ this ->wrapper ->patch (sprintf ("resources/%d/licenses/%d " , $ resource_id , $ license_id ), $ body );
112
+ }
113
+
114
+ /**
115
+ * Modify a temporary license (and convert to temporary if currently permanent).
80
116
*
81
117
* @param int The identifier of the resource.
82
118
* @param int The identifier of the license.
83
119
* @param int The start date of the license as a UNIX timestamp, or null if unchanged.
84
120
* @param int The end date of the license as a UNIX timestamp, or null if unchanged.
85
- * @param bool Whether or not the license should be active, or null if unchanged.
86
121
*
87
122
* @return APIResponse The parsed API response.
88
123
*/
89
- function modify (int $ resource_id , int $ license_id , int $ start_date , int $ end_date, bool $ active ): APIResponse {
124
+ function modifyTemporary (int $ resource_id , int $ license_id , int $ start_date , int $ end_date ): APIResponse {
90
125
$ body = [
126
+ "permanent " => false ,
91
127
"start_date " => $ start_date ,
92
128
"end_date " => $ end_date ,
93
- "active " => $ active
94
129
];
95
130
96
131
return $ this ->wrapper ->patch (sprintf ("resources/%d/licenses/%d " , $ resource_id , $ license_id ), $ body );
0 commit comments