Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Base class for eg ContactsRequestBuilderGetRequestConfiguration #1921

Closed
christophwille opened this issue May 23, 2023 · 2 comments · Fixed by #2227
Closed

Base class for eg ContactsRequestBuilderGetRequestConfiguration #1921

christophwille opened this issue May 23, 2023 · 2 comments · Fixed by #2227

Comments

@christophwille
Copy link

christophwille commented May 23, 2023

I'd like to set "common" properties (think page size) for a lot of GetAsync(requestBuilder => ...) calls. This however is made super-complicated because there is no interface or common base class, eg

        public class ContactsRequestBuilderGetRequestConfiguration {
            /// <summary>Request headers</summary>
            public RequestHeaders Headers { get; set; }
            /// <summary>Request options</summary>
            public IList<IRequestOption> Options { get; set; }
            /// <summary>Request query parameters</summary>
            public ContactsRequestBuilderGetQueryParameters QueryParameters { get; set; } = new ContactsRequestBuilderGetQueryParameters();
            /// <summary>
            /// Instantiates a new contactsRequestBuilderGetRequestConfiguration and sets the default values.
            /// </summary>
            public ContactsRequestBuilderGetRequestConfiguration() {
                Options = new List<IRequestOption>();
                Headers = new RequestHeaders();
            }
        }

Now I have to tease that object apart every time and pass on its internal properties to a common method (because RequestHeaders and friends ARE reused).

@andrueastman
Copy link
Member

This will be part of the next major version as this will be a breaking change and the configuration class should end inheriting from
the base class at the link below.

https://github.com/microsoft/kiota-abstractions-dotnet/blob/main/src/RequestConfiguration.cs

@christophwille
Copy link
Author

That is exactly what I was looking for (now looking forward to).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants