|
| 1 | +--- |
| 2 | +title: Reports |
| 3 | +description: API documentation for managing report recipients and report generation |
| 4 | +--- |
| 5 | + |
| 6 | +# Reports |
| 7 | + |
| 8 | +The Reports API allows you to manage report recipients who receive automated weekly and monthly reports. All report recipient operations require admin authentication. |
| 9 | + |
| 10 | +## ReportRecipient Type |
| 11 | + |
| 12 | +<ParamField body="email" type="String!" required> |
| 13 | + The email address of the report recipient |
| 14 | +</ParamField> |
| 15 | + |
| 16 | +<ParamField body="weekly" type="Boolean!" required> |
| 17 | + Whether the recipient should receive weekly reports |
| 18 | +</ParamField> |
| 19 | + |
| 20 | +<ParamField body="monthly" type="Boolean!" required> |
| 21 | + Whether the recipient should receive monthly reports |
| 22 | +</ParamField> |
| 23 | + |
| 24 | +--- |
| 25 | + |
| 26 | +## getReportRecipients |
| 27 | + |
| 28 | +Get a list of all report recipients. |
| 29 | + |
| 30 | +<RequestExample> |
| 31 | + |
| 32 | +```graphql |
| 33 | +query getReportRecipients { |
| 34 | + getReportRecipients { |
| 35 | + email |
| 36 | + weekly |
| 37 | + monthly |
| 38 | + } |
| 39 | +} |
| 40 | +``` |
| 41 | + |
| 42 | +</RequestExample> |
| 43 | + |
| 44 | +<ResponseExample> |
| 45 | + |
| 46 | +```json |
| 47 | +{ |
| 48 | + "data": { |
| 49 | + "getReportRecipients": [ |
| 50 | + { |
| 51 | + "email": "admin@example.com", |
| 52 | + "weekly": true, |
| 53 | + "monthly": true |
| 54 | + }, |
| 55 | + { |
| 56 | + "email": "manager@example.com", |
| 57 | + "weekly": false, |
| 58 | + "monthly": true |
| 59 | + } |
| 60 | + ] |
| 61 | + } |
| 62 | +} |
| 63 | +``` |
| 64 | + |
| 65 | +</ResponseExample> |
| 66 | + |
| 67 | +--- |
| 68 | + |
| 69 | +## createReportRecipient |
| 70 | + |
| 71 | +Create a new report recipient. |
| 72 | + |
| 73 | +<ParamField body="email" type="String!" required> |
| 74 | + The email address of the report recipient |
| 75 | +</ParamField> |
| 76 | + |
| 77 | +<ParamField body="weekly" type="Boolean!" required> |
| 78 | + Whether the recipient should receive weekly reports |
| 79 | +</ParamField> |
| 80 | + |
| 81 | +<ParamField body="monthly" type="Boolean!" required> |
| 82 | + Whether the recipient should receive monthly reports |
| 83 | +</ParamField> |
| 84 | + |
| 85 | +<RequestExample> |
| 86 | + |
| 87 | +```graphql |
| 88 | +mutation createReportRecipient( |
| 89 | + $email: String! |
| 90 | + $weekly: Boolean! |
| 91 | + $monthly: Boolean! |
| 92 | +) { |
| 93 | + createReportRecipient( |
| 94 | + email: $email |
| 95 | + weekly: $weekly |
| 96 | + monthly: $monthly |
| 97 | + ) { |
| 98 | + email |
| 99 | + weekly |
| 100 | + monthly |
| 101 | + } |
| 102 | +} |
| 103 | +``` |
| 104 | + |
| 105 | +</RequestExample> |
| 106 | + |
| 107 | +<RequestVariables> |
| 108 | + |
| 109 | +```json |
| 110 | +{ |
| 111 | + "email": "newrecipient@example.com", |
| 112 | + "weekly": true, |
| 113 | + "monthly": true |
| 114 | +} |
| 115 | +``` |
| 116 | + |
| 117 | +</RequestVariables> |
| 118 | + |
| 119 | +<ResponseExample> |
| 120 | + |
| 121 | +```json |
| 122 | +{ |
| 123 | + "data": { |
| 124 | + "createReportRecipient": { |
| 125 | + "email": "newrecipient@example.com", |
| 126 | + "weekly": true, |
| 127 | + "monthly": true |
| 128 | + } |
| 129 | + } |
| 130 | +} |
| 131 | +``` |
| 132 | + |
| 133 | +</ResponseExample> |
| 134 | + |
| 135 | +--- |
| 136 | + |
| 137 | +## updateReportRecipient |
| 138 | + |
| 139 | +Update an existing report recipient's preferences. |
| 140 | + |
| 141 | +<ParamField body="email" type="String!" required> |
| 142 | + The email address of the report recipient to update |
| 143 | +</ParamField> |
| 144 | + |
| 145 | +<ParamField body="weekly" type="Boolean"> |
| 146 | + Whether the recipient should receive weekly reports (optional) |
| 147 | +</ParamField> |
| 148 | + |
| 149 | +<ParamField body="monthly" type="Boolean"> |
| 150 | + Whether the recipient should receive monthly reports (optional) |
| 151 | +</ParamField> |
| 152 | + |
| 153 | +<RequestExample> |
| 154 | + |
| 155 | +```graphql |
| 156 | +mutation updateReportRecipient( |
| 157 | + $email: String! |
| 158 | + $weekly: Boolean |
| 159 | + $monthly: Boolean |
| 160 | +) { |
| 161 | + updateReportRecipient( |
| 162 | + email: $email |
| 163 | + weekly: $weekly |
| 164 | + monthly: $monthly |
| 165 | + ) { |
| 166 | + email |
| 167 | + weekly |
| 168 | + monthly |
| 169 | + } |
| 170 | +} |
| 171 | +``` |
| 172 | + |
| 173 | +</RequestExample> |
| 174 | + |
| 175 | +<RequestVariables> |
| 176 | + |
| 177 | +```json |
| 178 | +{ |
| 179 | + "email": "admin@example.com", |
| 180 | + "weekly": false, |
| 181 | + "monthly": true |
| 182 | +} |
| 183 | +``` |
| 184 | + |
| 185 | +</RequestVariables> |
| 186 | + |
| 187 | +<ResponseExample> |
| 188 | + |
| 189 | +```json |
| 190 | +{ |
| 191 | + "data": { |
| 192 | + "updateReportRecipient": { |
| 193 | + "email": "admin@example.com", |
| 194 | + "weekly": false, |
| 195 | + "monthly": true |
| 196 | + } |
| 197 | + } |
| 198 | +} |
| 199 | +``` |
| 200 | + |
| 201 | +</ResponseExample> |
| 202 | + |
| 203 | +<Warning> |
| 204 | +At least one of `weekly` or `monthly` must be provided. If both are omitted, the mutation will return an error. |
| 205 | +</Warning> |
| 206 | + |
| 207 | +--- |
| 208 | + |
| 209 | +## deleteReportRecipient |
| 210 | + |
| 211 | +Delete a report recipient. |
| 212 | + |
| 213 | +<ParamField body="email" type="String!" required> |
| 214 | + The email address of the report recipient to delete |
| 215 | +</ParamField> |
| 216 | + |
| 217 | +<RequestExample> |
| 218 | + |
| 219 | +```graphql |
| 220 | +mutation deleteReportRecipient($email: String!) { |
| 221 | + deleteReportRecipient(email: $email) { |
| 222 | + email |
| 223 | + weekly |
| 224 | + monthly |
| 225 | + } |
| 226 | +} |
| 227 | +``` |
| 228 | + |
| 229 | +</RequestExample> |
| 230 | + |
| 231 | +<RequestVariables> |
| 232 | + |
| 233 | +```json |
| 234 | +{ |
| 235 | + "email": "oldrecipient@example.com" |
| 236 | +} |
| 237 | +``` |
| 238 | + |
| 239 | +</RequestVariables> |
| 240 | + |
| 241 | +<ResponseExample> |
| 242 | + |
| 243 | +```json |
| 244 | +{ |
| 245 | + "data": { |
| 246 | + "deleteReportRecipient": { |
| 247 | + "email": "oldrecipient@example.com", |
| 248 | + "weekly": true, |
| 249 | + "monthly": false |
| 250 | + } |
| 251 | + } |
| 252 | +} |
| 253 | +``` |
| 254 | + |
| 255 | +</ResponseExample> |
0 commit comments