diff options
author | Wim <wim@42.be> | 2020-03-08 17:08:18 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-03-08 17:08:18 +0100 |
commit | 9785edd26366be8eb11c2435f50f90a5c8eea7fc (patch) | |
tree | e8e236b5b273e7535c607507cc059f3b957068a1 /vendor/github.com/matterbridge/msgraph.go/beta/DeviceRequest.go | |
parent | 2a0bc11b684f63305258e338c5f1d0e91eb24414 (diff) | |
download | matterbridge-msglm-9785edd26366be8eb11c2435f50f90a5c8eea7fc.tar.gz matterbridge-msglm-9785edd26366be8eb11c2435f50f90a5c8eea7fc.tar.bz2 matterbridge-msglm-9785edd26366be8eb11c2435f50f90a5c8eea7fc.zip |
Remove replace directives and use own fork to make go get work again (#1028)
See https://github.com/golang/go/issues/30354
go get doesn't honor the go.mod replace options.
Diffstat (limited to 'vendor/github.com/matterbridge/msgraph.go/beta/DeviceRequest.go')
-rw-r--r-- | vendor/github.com/matterbridge/msgraph.go/beta/DeviceRequest.go | 609 |
1 files changed, 609 insertions, 0 deletions
diff --git a/vendor/github.com/matterbridge/msgraph.go/beta/DeviceRequest.go b/vendor/github.com/matterbridge/msgraph.go/beta/DeviceRequest.go new file mode 100644 index 00000000..8b56fbf0 --- /dev/null +++ b/vendor/github.com/matterbridge/msgraph.go/beta/DeviceRequest.go @@ -0,0 +1,609 @@ +// Code generated by msgraph-generate.go DO NOT EDIT. + +package msgraph + +import ( + "context" + "fmt" + "io/ioutil" + "net/http" + + "github.com/matterbridge/msgraph.go/jsonx" +) + +// DeviceRequestBuilder is request builder for Device +type DeviceRequestBuilder struct{ BaseRequestBuilder } + +// Request returns DeviceRequest +func (b *DeviceRequestBuilder) Request() *DeviceRequest { + return &DeviceRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// DeviceRequest is request for Device +type DeviceRequest struct{ BaseRequest } + +// Get performs GET request for Device +func (r *DeviceRequest) Get(ctx context.Context) (resObj *Device, err error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + err = r.JSONRequest(ctx, "GET", query, nil, &resObj) + return +} + +// Update performs PATCH request for Device +func (r *DeviceRequest) Update(ctx context.Context, reqObj *Device) error { + return r.JSONRequest(ctx, "PATCH", "", reqObj, nil) +} + +// Delete performs DELETE request for Device +func (r *DeviceRequest) Delete(ctx context.Context) error { + return r.JSONRequest(ctx, "DELETE", "", nil, nil) +} + +// Commands returns request builder for Command collection +func (b *DeviceRequestBuilder) Commands() *DeviceCommandsCollectionRequestBuilder { + bb := &DeviceCommandsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/commands" + return bb +} + +// DeviceCommandsCollectionRequestBuilder is request builder for Command collection +type DeviceCommandsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for Command collection +func (b *DeviceCommandsCollectionRequestBuilder) Request() *DeviceCommandsCollectionRequest { + return &DeviceCommandsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for Command item +func (b *DeviceCommandsCollectionRequestBuilder) ID(id string) *CommandRequestBuilder { + bb := &CommandRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceCommandsCollectionRequest is request for Command collection +type DeviceCommandsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for Command collection +func (r *DeviceCommandsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Command, error) { + req, err := r.NewJSONRequest(method, path, obj) + if err != nil { + return nil, err + } + if ctx != nil { + req = req.WithContext(ctx) + } + res, err := r.client.Do(req) + if err != nil { + return nil, err + } + var values []Command + for { + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + b, _ := ioutil.ReadAll(res.Body) + errRes := &ErrorResponse{Response: res} + err := jsonx.Unmarshal(b, errRes) + if err != nil { + return nil, fmt.Errorf("%s: %s", res.Status, string(b)) + } + return nil, errRes + } + var ( + paging Paging + value []Command + ) + err := jsonx.NewDecoder(res.Body).Decode(&paging) + if err != nil { + return nil, err + } + err = jsonx.Unmarshal(paging.Value, &value) + if err != nil { + return nil, err + } + values = append(values, value...) + if len(paging.NextLink) == 0 { + return values, nil + } + req, err = http.NewRequest("GET", paging.NextLink, nil) + if ctx != nil { + req = req.WithContext(ctx) + } + res, err = r.client.Do(req) + if err != nil { + return nil, err + } + } +} + +// Get performs GET request for Command collection +func (r *DeviceCommandsCollectionRequest) Get(ctx context.Context) ([]Command, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for Command collection +func (r *DeviceCommandsCollectionRequest) Add(ctx context.Context, reqObj *Command) (resObj *Command, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// Extensions returns request builder for Extension collection +func (b *DeviceRequestBuilder) Extensions() *DeviceExtensionsCollectionRequestBuilder { + bb := &DeviceExtensionsCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/extensions" + return bb +} + +// DeviceExtensionsCollectionRequestBuilder is request builder for Extension collection +type DeviceExtensionsCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for Extension collection +func (b *DeviceExtensionsCollectionRequestBuilder) Request() *DeviceExtensionsCollectionRequest { + return &DeviceExtensionsCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for Extension item +func (b *DeviceExtensionsCollectionRequestBuilder) ID(id string) *ExtensionRequestBuilder { + bb := &ExtensionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceExtensionsCollectionRequest is request for Extension collection +type DeviceExtensionsCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for Extension collection +func (r *DeviceExtensionsCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]Extension, error) { + req, err := r.NewJSONRequest(method, path, obj) + if err != nil { + return nil, err + } + if ctx != nil { + req = req.WithContext(ctx) + } + res, err := r.client.Do(req) + if err != nil { + return nil, err + } + var values []Extension + for { + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + b, _ := ioutil.ReadAll(res.Body) + errRes := &ErrorResponse{Response: res} + err := jsonx.Unmarshal(b, errRes) + if err != nil { + return nil, fmt.Errorf("%s: %s", res.Status, string(b)) + } + return nil, errRes + } + var ( + paging Paging + value []Extension + ) + err := jsonx.NewDecoder(res.Body).Decode(&paging) + if err != nil { + return nil, err + } + err = jsonx.Unmarshal(paging.Value, &value) + if err != nil { + return nil, err + } + values = append(values, value...) + if len(paging.NextLink) == 0 { + return values, nil + } + req, err = http.NewRequest("GET", paging.NextLink, nil) + if ctx != nil { + req = req.WithContext(ctx) + } + res, err = r.client.Do(req) + if err != nil { + return nil, err + } + } +} + +// Get performs GET request for Extension collection +func (r *DeviceExtensionsCollectionRequest) Get(ctx context.Context) ([]Extension, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for Extension collection +func (r *DeviceExtensionsCollectionRequest) Add(ctx context.Context, reqObj *Extension) (resObj *Extension, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// MemberOf returns request builder for DirectoryObject collection +func (b *DeviceRequestBuilder) MemberOf() *DeviceMemberOfCollectionRequestBuilder { + bb := &DeviceMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/memberOf" + return bb +} + +// DeviceMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection +type DeviceMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for DirectoryObject collection +func (b *DeviceMemberOfCollectionRequestBuilder) Request() *DeviceMemberOfCollectionRequest { + return &DeviceMemberOfCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for DirectoryObject item +func (b *DeviceMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { + bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceMemberOfCollectionRequest is request for DirectoryObject collection +type DeviceMemberOfCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for DirectoryObject collection +func (r *DeviceMemberOfCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DirectoryObject, error) { + req, err := r.NewJSONRequest(method, path, obj) + if err != nil { + return nil, err + } + if ctx != nil { + req = req.WithContext(ctx) + } + res, err := r.client.Do(req) + if err != nil { + return nil, err + } + var values []DirectoryObject + for { + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + b, _ := ioutil.ReadAll(res.Body) + errRes := &ErrorResponse{Response: res} + err := jsonx.Unmarshal(b, errRes) + if err != nil { + return nil, fmt.Errorf("%s: %s", res.Status, string(b)) + } + return nil, errRes + } + var ( + paging Paging + value []DirectoryObject + ) + err := jsonx.NewDecoder(res.Body).Decode(&paging) + if err != nil { + return nil, err + } + err = jsonx.Unmarshal(paging.Value, &value) + if err != nil { + return nil, err + } + values = append(values, value...) + if len(paging.NextLink) == 0 { + return values, nil + } + req, err = http.NewRequest("GET", paging.NextLink, nil) + if ctx != nil { + req = req.WithContext(ctx) + } + res, err = r.client.Do(req) + if err != nil { + return nil, err + } + } +} + +// Get performs GET request for DirectoryObject collection +func (r *DeviceMemberOfCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for DirectoryObject collection +func (r *DeviceMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// RegisteredOwners returns request builder for DirectoryObject collection +func (b *DeviceRequestBuilder) RegisteredOwners() *DeviceRegisteredOwnersCollectionRequestBuilder { + bb := &DeviceRegisteredOwnersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/registeredOwners" + return bb +} + +// DeviceRegisteredOwnersCollectionRequestBuilder is request builder for DirectoryObject collection +type DeviceRegisteredOwnersCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for DirectoryObject collection +func (b *DeviceRegisteredOwnersCollectionRequestBuilder) Request() *DeviceRegisteredOwnersCollectionRequest { + return &DeviceRegisteredOwnersCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for DirectoryObject item +func (b *DeviceRegisteredOwnersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { + bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceRegisteredOwnersCollectionRequest is request for DirectoryObject collection +type DeviceRegisteredOwnersCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for DirectoryObject collection +func (r *DeviceRegisteredOwnersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DirectoryObject, error) { + req, err := r.NewJSONRequest(method, path, obj) + if err != nil { + return nil, err + } + if ctx != nil { + req = req.WithContext(ctx) + } + res, err := r.client.Do(req) + if err != nil { + return nil, err + } + var values []DirectoryObject + for { + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + b, _ := ioutil.ReadAll(res.Body) + errRes := &ErrorResponse{Response: res} + err := jsonx.Unmarshal(b, errRes) + if err != nil { + return nil, fmt.Errorf("%s: %s", res.Status, string(b)) + } + return nil, errRes + } + var ( + paging Paging + value []DirectoryObject + ) + err := jsonx.NewDecoder(res.Body).Decode(&paging) + if err != nil { + return nil, err + } + err = jsonx.Unmarshal(paging.Value, &value) + if err != nil { + return nil, err + } + values = append(values, value...) + if len(paging.NextLink) == 0 { + return values, nil + } + req, err = http.NewRequest("GET", paging.NextLink, nil) + if ctx != nil { + req = req.WithContext(ctx) + } + res, err = r.client.Do(req) + if err != nil { + return nil, err + } + } +} + +// Get performs GET request for DirectoryObject collection +func (r *DeviceRegisteredOwnersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for DirectoryObject collection +func (r *DeviceRegisteredOwnersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// RegisteredUsers returns request builder for DirectoryObject collection +func (b *DeviceRequestBuilder) RegisteredUsers() *DeviceRegisteredUsersCollectionRequestBuilder { + bb := &DeviceRegisteredUsersCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/registeredUsers" + return bb +} + +// DeviceRegisteredUsersCollectionRequestBuilder is request builder for DirectoryObject collection +type DeviceRegisteredUsersCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for DirectoryObject collection +func (b *DeviceRegisteredUsersCollectionRequestBuilder) Request() *DeviceRegisteredUsersCollectionRequest { + return &DeviceRegisteredUsersCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for DirectoryObject item +func (b *DeviceRegisteredUsersCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { + bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceRegisteredUsersCollectionRequest is request for DirectoryObject collection +type DeviceRegisteredUsersCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for DirectoryObject collection +func (r *DeviceRegisteredUsersCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DirectoryObject, error) { + req, err := r.NewJSONRequest(method, path, obj) + if err != nil { + return nil, err + } + if ctx != nil { + req = req.WithContext(ctx) + } + res, err := r.client.Do(req) + if err != nil { + return nil, err + } + var values []DirectoryObject + for { + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + b, _ := ioutil.ReadAll(res.Body) + errRes := &ErrorResponse{Response: res} + err := jsonx.Unmarshal(b, errRes) + if err != nil { + return nil, fmt.Errorf("%s: %s", res.Status, string(b)) + } + return nil, errRes + } + var ( + paging Paging + value []DirectoryObject + ) + err := jsonx.NewDecoder(res.Body).Decode(&paging) + if err != nil { + return nil, err + } + err = jsonx.Unmarshal(paging.Value, &value) + if err != nil { + return nil, err + } + values = append(values, value...) + if len(paging.NextLink) == 0 { + return values, nil + } + req, err = http.NewRequest("GET", paging.NextLink, nil) + if ctx != nil { + req = req.WithContext(ctx) + } + res, err = r.client.Do(req) + if err != nil { + return nil, err + } + } +} + +// Get performs GET request for DirectoryObject collection +func (r *DeviceRegisteredUsersCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for DirectoryObject collection +func (r *DeviceRegisteredUsersCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} + +// TransitiveMemberOf returns request builder for DirectoryObject collection +func (b *DeviceRequestBuilder) TransitiveMemberOf() *DeviceTransitiveMemberOfCollectionRequestBuilder { + bb := &DeviceTransitiveMemberOfCollectionRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/transitiveMemberOf" + return bb +} + +// DeviceTransitiveMemberOfCollectionRequestBuilder is request builder for DirectoryObject collection +type DeviceTransitiveMemberOfCollectionRequestBuilder struct{ BaseRequestBuilder } + +// Request returns request for DirectoryObject collection +func (b *DeviceTransitiveMemberOfCollectionRequestBuilder) Request() *DeviceTransitiveMemberOfCollectionRequest { + return &DeviceTransitiveMemberOfCollectionRequest{ + BaseRequest: BaseRequest{baseURL: b.baseURL, client: b.client}, + } +} + +// ID returns request builder for DirectoryObject item +func (b *DeviceTransitiveMemberOfCollectionRequestBuilder) ID(id string) *DirectoryObjectRequestBuilder { + bb := &DirectoryObjectRequestBuilder{BaseRequestBuilder: b.BaseRequestBuilder} + bb.baseURL += "/" + id + return bb +} + +// DeviceTransitiveMemberOfCollectionRequest is request for DirectoryObject collection +type DeviceTransitiveMemberOfCollectionRequest struct{ BaseRequest } + +// Paging perfoms paging operation for DirectoryObject collection +func (r *DeviceTransitiveMemberOfCollectionRequest) Paging(ctx context.Context, method, path string, obj interface{}) ([]DirectoryObject, error) { + req, err := r.NewJSONRequest(method, path, obj) + if err != nil { + return nil, err + } + if ctx != nil { + req = req.WithContext(ctx) + } + res, err := r.client.Do(req) + if err != nil { + return nil, err + } + var values []DirectoryObject + for { + defer res.Body.Close() + if res.StatusCode != http.StatusOK { + b, _ := ioutil.ReadAll(res.Body) + errRes := &ErrorResponse{Response: res} + err := jsonx.Unmarshal(b, errRes) + if err != nil { + return nil, fmt.Errorf("%s: %s", res.Status, string(b)) + } + return nil, errRes + } + var ( + paging Paging + value []DirectoryObject + ) + err := jsonx.NewDecoder(res.Body).Decode(&paging) + if err != nil { + return nil, err + } + err = jsonx.Unmarshal(paging.Value, &value) + if err != nil { + return nil, err + } + values = append(values, value...) + if len(paging.NextLink) == 0 { + return values, nil + } + req, err = http.NewRequest("GET", paging.NextLink, nil) + if ctx != nil { + req = req.WithContext(ctx) + } + res, err = r.client.Do(req) + if err != nil { + return nil, err + } + } +} + +// Get performs GET request for DirectoryObject collection +func (r *DeviceTransitiveMemberOfCollectionRequest) Get(ctx context.Context) ([]DirectoryObject, error) { + var query string + if r.query != nil { + query = "?" + r.query.Encode() + } + return r.Paging(ctx, "GET", query, nil) +} + +// Add performs POST request for DirectoryObject collection +func (r *DeviceTransitiveMemberOfCollectionRequest) Add(ctx context.Context, reqObj *DirectoryObject) (resObj *DirectoryObject, err error) { + err = r.JSONRequest(ctx, "POST", "", reqObj, &resObj) + return +} |