github.com/yaegashi/msgraph.go@v0.1.4/beta/RequestInformation.go (about) 1 // Code generated by msgraph.go/gen DO NOT EDIT. 2 3 package msgraph 4 5 import ( 6 "context" 7 "fmt" 8 "io/ioutil" 9 "net/http" 10 11 "github.com/yaegashi/msgraph.go/jsonx" 12 ) 13 14 // InformationProtectionRequestBuilder is request builder for InformationProtection 15 type InformationProtectionRequestBuilder struct{ BaseRequestBuilder } 16 17 // Request returns InformationProtectionRequest 18 func (b *InformationProtectionRequestBuilder) Request() *InformationProtectionRequest { 19 return &InformationProtectionRequest{ 20 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, 21 } 22 } 23 24 // InformationProtectionRequest is request for InformationProtection 25 type InformationProtectionRequest struct{ BaseRequest } 26 27 // Get performs GET request for InformationProtection 28 func (r *InformationProtectionRequest) Get(ctx context.Context) (resObj *InformationProtection, err error) { 29 var query string 30 if r.query != nil { 31 query = "?" + r.query.Encode() 32 } 33 err = r.JSONRequest(ctx, "GET", query, nil, &resObj) 34 return 35 } 36 37 // Update performs PATCH request for InformationProtection 38 func (r *InformationProtectionRequest) Update(ctx context.Context, reqObj *InformationProtection) error { 39 return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) 40 } 41 42 // Delete performs DELETE request for InformationProtection 43 func (r *InformationProtectionRequest) Delete(ctx context.Context) error { 44 return r.JSONRequest(ctx, "DELETE", "", nil, nil) 45 } 46 47 // InformationProtectionLabelRequestBuilder is request builder for InformationProtectionLabel 48 type InformationProtectionLabelRequestBuilder struct{ BaseRequestBuilder } 49 50 // Request returns InformationProtectionLabelRequest 51 func (b *InformationProtectionLabelRequestBuilder) Request() *InformationProtectionLabelRequest { 52 return &InformationProtectionLabelRequest{ 53 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, 54 } 55 } 56 57 // InformationProtectionLabelRequest is request for InformationProtectionLabel 58 type InformationProtectionLabelRequest struct{ BaseRequest } 59 60 // Get performs GET request for InformationProtectionLabel 61 func (r *InformationProtectionLabelRequest) Get(ctx context.Context) (resObj *InformationProtectionLabel, err error) { 62 var query string 63 if r.query != nil { 64 query = "?" + r.query.Encode() 65 } 66 err = r.JSONRequest(ctx, "GET", query, nil, &resObj) 67 return 68 } 69 70 // Update performs PATCH request for InformationProtectionLabel 71 func (r *InformationProtectionLabelRequest) Update(ctx context.Context, reqObj *InformationProtectionLabel) error { 72 return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) 73 } 74 75 // Delete performs DELETE request for InformationProtectionLabel 76 func (r *InformationProtectionLabelRequest) Delete(ctx context.Context) error { 77 return r.JSONRequest(ctx, "DELETE", "", nil, nil) 78 } 79 80 // InformationProtectionPolicyRequestBuilder is request builder for InformationProtectionPolicy 81 type InformationProtectionPolicyRequestBuilder struct{ BaseRequestBuilder } 82 83 // Request returns InformationProtectionPolicyRequest 84 func (b *InformationProtectionPolicyRequestBuilder) Request() *InformationProtectionPolicyRequest { 85 return &InformationProtectionPolicyRequest{ 86 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, 87 } 88 } 89 90 // InformationProtectionPolicyRequest is request for InformationProtectionPolicy 91 type InformationProtectionPolicyRequest struct{ BaseRequest } 92 93 // Get performs GET request for InformationProtectionPolicy 94 func (r *InformationProtectionPolicyRequest) Get(ctx context.Context) (resObj *InformationProtectionPolicy, err error) { 95 var query string 96 if r.query != nil { 97 query = "?" + r.query.Encode() 98 } 99 err = r.JSONRequest(ctx, "GET", query, nil, &resObj) 100 return 101 } 102 103 // Update performs PATCH request for InformationProtectionPolicy 104 func (r *InformationProtectionPolicyRequest) Update(ctx context.Context, reqObj *InformationProtectionPolicy) error { 105 return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) 106 } 107 108 // Delete performs DELETE request for InformationProtectionPolicy 109 func (r *InformationProtectionPolicyRequest) Delete(ctx context.Context) error { 110 return r.JSONRequest(ctx, "DELETE", "", nil, nil) 111 } 112 113 // 114 type InformationProtectionLabelCollectionExtractLabelRequestBuilder struct{ BaseRequestBuilder } 115 116 // ExtractLabel action undocumented 117 func (b *InformationProtectionPolicyLabelsCollectionRequestBuilder) ExtractLabel(reqObj *InformationProtectionLabelCollectionExtractLabelRequestParameter) *InformationProtectionLabelCollectionExtractLabelRequestBuilder { 118 bb := &InformationProtectionLabelCollectionExtractLabelRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 119 bb.BaseRequestBuilder.baseURL += "/extractLabel" 120 bb.BaseRequestBuilder.requestObject = reqObj 121 return bb 122 } 123 124 // 125 type InformationProtectionLabelCollectionExtractLabelRequest struct{ BaseRequest } 126 127 // 128 func (b *InformationProtectionLabelCollectionExtractLabelRequestBuilder) Request() *InformationProtectionLabelCollectionExtractLabelRequest { 129 return &InformationProtectionLabelCollectionExtractLabelRequest{ 130 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject}, 131 } 132 } 133 134 // 135 func (r *InformationProtectionLabelCollectionExtractLabelRequest) Post(ctx context.Context) (resObj *InformationProtectionContentLabel, err error) { 136 err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj) 137 return 138 } 139 140 // 141 type InformationProtectionLabelCollectionEvaluateApplicationRequestBuilder struct{ BaseRequestBuilder } 142 143 // EvaluateApplication action undocumented 144 func (b *InformationProtectionPolicyLabelsCollectionRequestBuilder) EvaluateApplication(reqObj *InformationProtectionLabelCollectionEvaluateApplicationRequestParameter) *InformationProtectionLabelCollectionEvaluateApplicationRequestBuilder { 145 bb := &InformationProtectionLabelCollectionEvaluateApplicationRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 146 bb.BaseRequestBuilder.baseURL += "/evaluateApplication" 147 bb.BaseRequestBuilder.requestObject = reqObj 148 return bb 149 } 150 151 // 152 type InformationProtectionLabelCollectionEvaluateApplicationRequest struct{ BaseRequest } 153 154 // 155 func (b *InformationProtectionLabelCollectionEvaluateApplicationRequestBuilder) Request() *InformationProtectionLabelCollectionEvaluateApplicationRequest { 156 return &InformationProtectionLabelCollectionEvaluateApplicationRequest{ 157 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject}, 158 } 159 } 160 161 // 162 func (r *InformationProtectionLabelCollectionEvaluateApplicationRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]InformationProtectionAction, error) { 163 req, err := r.NewJSONRequest(method, path, obj) 164 if err != nil { 165 return nil, err 166 } 167 if ctx != nil { 168 req = req.WithContext(ctx) 169 } 170 res, err := r.client.Do(req) 171 if err != nil { 172 return nil, err 173 } 174 var values []InformationProtectionAction 175 for { 176 if res.StatusCode != http.StatusOK { 177 b, _ := ioutil.ReadAll(res.Body) 178 res.Body.Close() 179 errRes := &ErrorResponse{Response: res} 180 err := jsonx.Unmarshal(b, errRes) 181 if err != nil { 182 return nil, fmt.Errorf("%s: %s", res.Status, string(b)) 183 } 184 return nil, errRes 185 } 186 var ( 187 paging Paging 188 value []InformationProtectionAction 189 ) 190 err := jsonx.NewDecoder(res.Body).Decode(&paging) 191 res.Body.Close() 192 if err != nil { 193 return nil, err 194 } 195 err = jsonx.Unmarshal(paging.Value, &value) 196 if err != nil { 197 return nil, err 198 } 199 values = append(values, value...) 200 if n >= 0 { 201 n-- 202 } 203 if n == 0 || len(paging.NextLink) == 0 { 204 return values, nil 205 } 206 req, err = http.NewRequest("GET", paging.NextLink, nil) 207 if ctx != nil { 208 req = req.WithContext(ctx) 209 } 210 res, err = r.client.Do(req) 211 if err != nil { 212 return nil, err 213 } 214 } 215 } 216 217 // 218 func (r *InformationProtectionLabelCollectionEvaluateApplicationRequest) PostN(ctx context.Context, n int) ([]InformationProtectionAction, error) { 219 return r.Paging(ctx, "POST", "", r.requestObject, n) 220 } 221 222 // 223 func (r *InformationProtectionLabelCollectionEvaluateApplicationRequest) Post(ctx context.Context) ([]InformationProtectionAction, error) { 224 return r.Paging(ctx, "POST", "", r.requestObject, 0) 225 } 226 227 // 228 type InformationProtectionLabelCollectionEvaluateRemovalRequestBuilder struct{ BaseRequestBuilder } 229 230 // EvaluateRemoval action undocumented 231 func (b *InformationProtectionPolicyLabelsCollectionRequestBuilder) EvaluateRemoval(reqObj *InformationProtectionLabelCollectionEvaluateRemovalRequestParameter) *InformationProtectionLabelCollectionEvaluateRemovalRequestBuilder { 232 bb := &InformationProtectionLabelCollectionEvaluateRemovalRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 233 bb.BaseRequestBuilder.baseURL += "/evaluateRemoval" 234 bb.BaseRequestBuilder.requestObject = reqObj 235 return bb 236 } 237 238 // 239 type InformationProtectionLabelCollectionEvaluateRemovalRequest struct{ BaseRequest } 240 241 // 242 func (b *InformationProtectionLabelCollectionEvaluateRemovalRequestBuilder) Request() *InformationProtectionLabelCollectionEvaluateRemovalRequest { 243 return &InformationProtectionLabelCollectionEvaluateRemovalRequest{ 244 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject}, 245 } 246 } 247 248 // 249 func (r *InformationProtectionLabelCollectionEvaluateRemovalRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]InformationProtectionAction, error) { 250 req, err := r.NewJSONRequest(method, path, obj) 251 if err != nil { 252 return nil, err 253 } 254 if ctx != nil { 255 req = req.WithContext(ctx) 256 } 257 res, err := r.client.Do(req) 258 if err != nil { 259 return nil, err 260 } 261 var values []InformationProtectionAction 262 for { 263 if res.StatusCode != http.StatusOK { 264 b, _ := ioutil.ReadAll(res.Body) 265 res.Body.Close() 266 errRes := &ErrorResponse{Response: res} 267 err := jsonx.Unmarshal(b, errRes) 268 if err != nil { 269 return nil, fmt.Errorf("%s: %s", res.Status, string(b)) 270 } 271 return nil, errRes 272 } 273 var ( 274 paging Paging 275 value []InformationProtectionAction 276 ) 277 err := jsonx.NewDecoder(res.Body).Decode(&paging) 278 res.Body.Close() 279 if err != nil { 280 return nil, err 281 } 282 err = jsonx.Unmarshal(paging.Value, &value) 283 if err != nil { 284 return nil, err 285 } 286 values = append(values, value...) 287 if n >= 0 { 288 n-- 289 } 290 if n == 0 || len(paging.NextLink) == 0 { 291 return values, nil 292 } 293 req, err = http.NewRequest("GET", paging.NextLink, nil) 294 if ctx != nil { 295 req = req.WithContext(ctx) 296 } 297 res, err = r.client.Do(req) 298 if err != nil { 299 return nil, err 300 } 301 } 302 } 303 304 // 305 func (r *InformationProtectionLabelCollectionEvaluateRemovalRequest) PostN(ctx context.Context, n int) ([]InformationProtectionAction, error) { 306 return r.Paging(ctx, "POST", "", r.requestObject, n) 307 } 308 309 // 310 func (r *InformationProtectionLabelCollectionEvaluateRemovalRequest) Post(ctx context.Context) ([]InformationProtectionAction, error) { 311 return r.Paging(ctx, "POST", "", r.requestObject, 0) 312 } 313 314 // 315 type InformationProtectionLabelCollectionEvaluateClassificationResultsRequestBuilder struct{ BaseRequestBuilder } 316 317 // EvaluateClassificationResults action undocumented 318 func (b *InformationProtectionPolicyLabelsCollectionRequestBuilder) EvaluateClassificationResults(reqObj *InformationProtectionLabelCollectionEvaluateClassificationResultsRequestParameter) *InformationProtectionLabelCollectionEvaluateClassificationResultsRequestBuilder { 319 bb := &InformationProtectionLabelCollectionEvaluateClassificationResultsRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 320 bb.BaseRequestBuilder.baseURL += "/evaluateClassificationResults" 321 bb.BaseRequestBuilder.requestObject = reqObj 322 return bb 323 } 324 325 // 326 type InformationProtectionLabelCollectionEvaluateClassificationResultsRequest struct{ BaseRequest } 327 328 // 329 func (b *InformationProtectionLabelCollectionEvaluateClassificationResultsRequestBuilder) Request() *InformationProtectionLabelCollectionEvaluateClassificationResultsRequest { 330 return &InformationProtectionLabelCollectionEvaluateClassificationResultsRequest{ 331 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject}, 332 } 333 } 334 335 // 336 func (r *InformationProtectionLabelCollectionEvaluateClassificationResultsRequest) Paging(ctx context.Context, method, path string, obj interface{}, n int) ([]InformationProtectionAction, error) { 337 req, err := r.NewJSONRequest(method, path, obj) 338 if err != nil { 339 return nil, err 340 } 341 if ctx != nil { 342 req = req.WithContext(ctx) 343 } 344 res, err := r.client.Do(req) 345 if err != nil { 346 return nil, err 347 } 348 var values []InformationProtectionAction 349 for { 350 if res.StatusCode != http.StatusOK { 351 b, _ := ioutil.ReadAll(res.Body) 352 res.Body.Close() 353 errRes := &ErrorResponse{Response: res} 354 err := jsonx.Unmarshal(b, errRes) 355 if err != nil { 356 return nil, fmt.Errorf("%s: %s", res.Status, string(b)) 357 } 358 return nil, errRes 359 } 360 var ( 361 paging Paging 362 value []InformationProtectionAction 363 ) 364 err := jsonx.NewDecoder(res.Body).Decode(&paging) 365 res.Body.Close() 366 if err != nil { 367 return nil, err 368 } 369 err = jsonx.Unmarshal(paging.Value, &value) 370 if err != nil { 371 return nil, err 372 } 373 values = append(values, value...) 374 if n >= 0 { 375 n-- 376 } 377 if n == 0 || len(paging.NextLink) == 0 { 378 return values, nil 379 } 380 req, err = http.NewRequest("GET", paging.NextLink, nil) 381 if ctx != nil { 382 req = req.WithContext(ctx) 383 } 384 res, err = r.client.Do(req) 385 if err != nil { 386 return nil, err 387 } 388 } 389 } 390 391 // 392 func (r *InformationProtectionLabelCollectionEvaluateClassificationResultsRequest) PostN(ctx context.Context, n int) ([]InformationProtectionAction, error) { 393 return r.Paging(ctx, "POST", "", r.requestObject, n) 394 } 395 396 // 397 func (r *InformationProtectionLabelCollectionEvaluateClassificationResultsRequest) Post(ctx context.Context) ([]InformationProtectionAction, error) { 398 return r.Paging(ctx, "POST", "", r.requestObject, 0) 399 } 400 401 // 402 type InformationProtectionEvaluateLabelsAndPoliciesRequestBuilder struct{ BaseRequestBuilder } 403 404 // EvaluateLabelsAndPolicies action undocumented 405 func (b *InformationProtectionRequestBuilder) EvaluateLabelsAndPolicies(reqObj *InformationProtectionEvaluateLabelsAndPoliciesRequestParameter) *InformationProtectionEvaluateLabelsAndPoliciesRequestBuilder { 406 bb := &InformationProtectionEvaluateLabelsAndPoliciesRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} 407 bb.BaseRequestBuilder.baseURL += "/evaluateLabelsAndPolicies" 408 bb.BaseRequestBuilder.requestObject = reqObj 409 return bb 410 } 411 412 // 413 type InformationProtectionEvaluateLabelsAndPoliciesRequest struct{ BaseRequest } 414 415 // 416 func (b *InformationProtectionEvaluateLabelsAndPoliciesRequestBuilder) Request() *InformationProtectionEvaluateLabelsAndPoliciesRequest { 417 return &InformationProtectionEvaluateLabelsAndPoliciesRequest{ 418 BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client, requestObject: b.requestObject}, 419 } 420 } 421 422 // 423 func (r *InformationProtectionEvaluateLabelsAndPoliciesRequest) Post(ctx context.Context) (resObj *EvaluateLabelsAndPoliciesJobResponse, err error) { 424 err = r.JSONRequest(ctx, "POST", "", r.requestObject, &resObj) 425 return 426 }