Commit Graph

330 Commits

Author SHA1 Message Date
Kato Stølen 4fbbe4ca2c Add cancellation token support for release assets uploading (#2267) 2021-02-21 17:08:30 -04:00
Jose de Jesus Medina 66a6781584 spellcheck round 2 (#2259) 2020-10-06 09:47:36 -03:00
Brendan Forster 08e7c14ced drop unused code related to PORTABLE flag (#2202) 2020-06-08 08:33:27 -03:00
Fredrik Høisæther Rasch af74ae8e20 Add Server Time Difference to ApiInfo (#2196) 2020-06-07 18:25:34 -03:00
Brendan Forster 287861e4a7 rewrite the setup of responses to use a standard helper function (#2177) 2020-04-14 11:30:15 -03:00
Cédric Luthi 69d118230d Add support to get raw file content as byte[] (#2151) 2020-04-12 13:22:35 -03:00
Brendan Forster 8d7bda96e4 handle case insensitive headers when parsing for API rate limiting (#2175) 2020-04-12 13:04:30 -03:00
Next Turn fd3b1c7e79 Add support for ReleaseEvent payload (#2170) 2020-04-11 20:44:57 -03:00
Brendan Forster 327020750f add convention test for preview APIs (#2154) 2020-03-18 08:52:50 -03:00
Brendan Forster e9516bb6c1 bugfix: improve fallback when StringEnum encounters null value (#2156) 2020-03-17 15:09:15 -03:00
Cédric Luthi c94cd05b8b Obsolete UnixTimestampExtensions methods (#2121)
* The equivalent of `public static DateTimeOffset FromUnixTime(this long unixTime)` exists in the framework since .NET Framework 4.6: https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.fromunixtimeseconds
* The equivalent of `public static long ToUnixTime(this DateTimeOffset date)` exists in the framework since .NET Framework 4.6: https://docs.microsoft.com/en-us/dotnet/api/system.datetimeoffset.tounixtimeseconds
2020-03-03 09:30:30 -04:00
Jose de Jesus Medina 5eb9f06b24 Fix typos in comments (#2040) 2019-10-30 13:51:20 -03:00
Ryan Gribble 6385e2dcbd Don't apply Tls1.2 workaround when .NET 4.7 SystemDefault is set (#1936)
* Dont touch SecurityProtocol if current value is new SystemDefault added in .NET 4.7
Add comment to explain what we are doing

* Update Octokit/Http/HttpClientAdapter.cs

Co-Authored-By: ryangribble <ryangribble@users.noreply.github.com>

* Update Octokit/Http/HttpClientAdapter.cs

Co-Authored-By: ryangribble <ryangribble@users.noreply.github.com>

* Update Octokit/Http/HttpClientAdapter.cs

Co-Authored-By: ryangribble <ryangribble@users.noreply.github.com>

* Update Octokit/Http/HttpClientAdapter.cs

Co-Authored-By: ryangribble <ryangribble@users.noreply.github.com>
2019-02-27 21:30:42 +10:00
Guillaume Mouron 47c38bfd8e Add support for CreateEventPayload and DeleteEvent payload (#1646) (#1932) 2019-01-31 20:37:00 +10:00
Ryan Gribble cee6635861 provide a Delete<T>() overload that takes a Uri and accept header, but no body (#1868) 2018-09-09 09:59:31 +10:00
Ryan Gribble c5d5df5b08 Implement Check Runs API (#1847)
* Add CheckRunEventPayload

* add CheckRunEventPayload into all the right places

* forgot integration tests for RepositoryId methods (+1 squashed commits)

Squashed commits:

[b2445bf3] Implement Create CheckRun methods for normal and observable clients including unit and integration tests and xmldoc comments

* Implement Update CheckRun method
Refactored NewCheckRun to inherit CheckRunUpdate since they share all fields except HeadSha

* Implement GetAllForReference method

* Implement GetAllForCheckSuite method

* tweak XmlDoc to match github documentation

* Implement Get method

* Implement GetAllAnnotations
Moved CheckRunAnnotation model from Request to Common and added a parameterless ctor, since it is now a response model as well as a request model

* Split common CheckRunAnnotation model into separate response and request models due to different field and ctor requirements
Rename other CheckRun request sub classes to be consistent with NewCheckRunAnnotation (eg NewCheckRunOutput, NewCheckRunImage, etc)

* add title field back into CheckRunAnnotation

* fix up XmlDocs

* fix mutable response property - hooray for convention tests!
2018-07-19 08:29:12 +10:00
Ryan Gribble 4df21a61de Implement Check Suites API (#1846)
* Check run request models

* Check Run response models

* Check run clients

* Check run ApiUrls and AcceptHeaders

* Pack it all together for now

* Add missing accept headers to connection calls

* Standardize class definitions

* Standardize function names

* Merge ICheckRunAnnotationsClient into ICheckRunsClient

* Properly organize clients

* Cleanup CheckRun response model

* Fix slug check run urls

* Add checks installation permission

* Use StringEnums where appropriate

* Cleanup check run output models

* Flesh out CheckSuite model

* Delete CheckRunsList

* Remove a sealed, fix some line endings

* Adding check suite models

* Skeleton check suite client implementation

* Add check suite ApiUrls

* Flesh out check suites client

* Add parameterless CheckRun constructor

* Add DebuggerDisplay to checks models

* Add observable checks interfaces

* Add return values to POST and PATCH check clients

* Fix some check suite client return values

* Skeleton reactive checks implementation

* Implement observable checks clients

* Remove rogue tabs

* Add CheckSuiteEventPayload

* Add CheckRunEventPayload

* Add DebuggerDisplay attributes to checks API payloads

* Properly nullables check suite/run conclusion

* Add CheckSuiteEventTests

* Fix checks client accessor naming issues

* Add missing Text field to CheckRunOutput

* Marks CheckRunUpdate's conclusion as nullable

* Fix reactive checks client naming

* Today I learned DateTimeOffset is a struct

Makes CheckRunUpdate's DateTimeOffsets nullable

* Modify check clients to put slug version before repo id version

* Add nullable to CheckRun.CompletedAt

* Implement parameterless ICheckRunsClient.GetAllForReference and GetAllForCheckSuite

* Add missing RequestParameters base to CheckSuiteRequest

* Implement checks API GetAll methods

* Bring parity to Reactive checks clients

* fix project settings to get GitHubApp helper working again

* remove un-needed InstallationId setting - provide helper method to find installation based on owner

* fix up request object ctors based on required/optional parameters

* fix up request object ctors based on required/optional parameters

* add some initial integration tests for CheckSuites and CheckRuns including some helper methods

* Add test for Request CheckSuite
Fix Request CheckSuite to use correct Uri
Fix Request CheckSuite return type as it doesnt return an object
Fix CheckSuiteTriggerRequest ctor to make required fields mandatory

* simplify Get CheckSuite test to not require as much data setup

* Add test for CheckSuite GetAllForReference

* Add test for CheckSuite UpdatePreferences

* rename response models

* rename CheckSuitesList to CheckSuitesResponse and use as response to the GetAll calls

* Fix tests

* Fix observable

* fix model convention tests

* remove CheckRuns so we can focus only on CheckSuites for now

* naming things is hard

* oh so many unit tests for CheckSuites methods

* make client mockable

* Fix issue with .Max() when no results returned

* fix request parameter names

* add Xml doc comments

* Add XmlDoc comments to request/common model objects

* rename class to match usage

* tidy ups

* xmldoc for observable clients

* fix method order

* add observable unit tests and get them passing

* Add Observable unit tests and get them passing

* add observable integration tests

* tidy up ApiUrl method name

* whitespace/using tidy ups

* Ensure CheckSuiteEventPayload class is handled in deserializer and add to activity test

* add response model XmlDoc comments

* missed one xmldoc

* add xmldoc to NewCheckSuite request and remove HeadBranch property as it doesnt exist anymore

* add some extra check suites integration tests
2018-07-14 20:01:41 +10:00
tasadar2 3345f76fc9 Adding a convention test to detect whether a model has a constructor exposing all properties (#1798)
* Added a convention test to detect a model constructor exposing all properties

* add ctors to classes where they are missing

* rename ctor parameters that dont match properties

* add missing parameters to existing ctors

* add specific PunchCard ctor to allow mocking, and update test to resolve call ambiguity

* Added base class properties to the convention test

Added member exclusion attribute

* Updated newly offending classes

2 excludes and 2 ctors

* rename exclusion attribute to be a bit shorter
2018-04-25 21:03:13 +10:00
Itai Bar-Haim 5ffc96995f Adding initial support for GitHub Apps. (#1738)
* Added authentication using bearer token.

* Added Installation and AccessToken clients.

* Added new clients to Reactive project

* added support for DateTime serialized as FileTime

* added support for StatusEventPayload

* added support for StatusEventPayload

* Added test for StatusEventPayload and fixed serializer to return that event payload type.

* WIP - added ApplicationClient and related Api Urls.

* Continued implementing Installations support.

* Fixing build (WIP)

* fixed build

* added Account property to Installation. prefer nameof(x) over literal "x".

* fixed according to code review.

* fixed build.

* switched Installation ID from int to long.

* added Permissions and Events properties to Installation.

* added documentation to Application and Installation properties in IGitHubClient.

* wip - added tests to new clients

* wip - fix build

* wip - fixed build.

* added InstallationsClient tests.

* added integration test for InstallationsClient.

* changes requested in code review.

* add Get method for App

* Create GitHubApp response model instead of re-using existing Application response model

* add Get method to observable client

* fixed build (both locally and failed test).

* Fixed documentation and added some missing XML docs.

* added DebuggerDisplay to StatusEventPayload

* updated XML docs and added some missing bits. prefer nameof(x) over literal "x".

* Add xml comments to AccessToken response model and use DateTimeOffset rather than DateTime

* Tidy up XmlComments and make consistent across client and observable client and interfaces

* fixup unit tests to independently verify preview header

* Implement GetInstallation method

* revert commits unrelated to GitHubApps - these can be done on a separate PR if required

* this extra authenticator class doesnt appear to be used anywhere

* undo project file change as it doesnt appear to be necessary

* Revert "Merge remote-tracking branch 'remote/GitHubApps' into GitHubApps"

This reverts commit c53cc110b8d807f62fdfeaa7df19e1532d050007, reversing
changes made to 0c9e413d420a4725738644ea5b13af6ec102d456.

* Revert "Revert "Merge remote-tracking branch 'remote/GitHubApps' into GitHubApps""

This reverts commit 02d52b8adf814b6945c60cb59a907a8cd34b1ce7.

* add XmlDoc comments to response models and flesh out installation permissions

* name AcceptHeaders member consistently

* accidentally lost changes to Credentials.cs

* Enhance Intergation test framework to handle GitHubApp settings and discoer tests appropriately
Get code ready for GitHubJWT nuget package but for now just hardcode a JWT in ENV VAR
Add 1 integration test for each method and ensure they are working!

* fixed compiler warnings.

* Added support for Installation=>Id field that arrives in a Pull Request Event payload.

(See the last field in the sample JSON of https://developer.github.com/v3/activity/events/types/#pullrequestevent)

* Change integration test project to netcoreapp2.0 so we can use GitHubJwt nuget package in integration tests

* First cut at some GitHubApp doco

* update mkdocs config

* Moved the Installation property to ActivityPayload, so it's available in all payloads.

This feature is not undocumented, unfortunately, but valid:
https://platform.github.community/t/determining-which-installation-an-event-came-from/539/11

* Split Installation to Installation and InstallationId, and added a comfort method for gaining its AccessToken.

* fixed InstallationId CreateAccessToken to receive IGitHubAppsClient. added (and fixed) docs.

* reverted object-oriented style comfort method and it's docs.

* update all test projects to netcoreapp2.0

* tweak build configs to use 2.0.3 SDK

* also need to update cake frosting build to netcoreapp2.0

* tweak docs some more

* fix convention test failures

* test projects still had some old runtime parts in them!

* travis osx image needs to be at least 10.12 for .NET Core 2.0

* shell script might need the same argument tweak for cake

* more doc tweaks

* Make sure compiler warning output isnt somehow causing Linux and OSX builds to fail

* moar logging for linux/OSX builds

* stop sourcelink on linux/OSX builds to see if that is the problem

* set verbosity to detailed for the dotnet build step

* try new sourcelink and list out remotes

* is travis being weird with git clone?

* SourceLink may be defaulting to true on CI server so explicitly set it as false rather than omitting it

* detailed is a bit too verbose for travis, try normal

* turn sourcelink back on for Linux/OSX

* fix compiler warning

* Try SourceLink.Create.CommandLine instead of SourceLink.Create.GitHub

* CliToolReferences did not update to latest versions

* remove debug origin info

* turn off msbuild output

* go back to SourceLink.Create.GitHub!

* time diff between dev PC and API causes issues if specifying a full 600 second token

* handle extra date format that Installation end point now returns

* field needs to be protected in order to be deserialized

* provide even more buffer for client vs server clock drift

* Update to latest GitHubJwt reference

* go back to SDK 1 since SDK 2 is having sporadic travisCI faliures in TestSourceLink build step

* get appveyor working

* update sourcelink back to latest, and use SDK 1.04 (runtime 1.0.5)
2018-04-16 20:42:23 +10:00
Itai Bar-Haim 4e804f61a6 Prefer using nameof(x) over literal "x" (#1781)
* updated XML docs and added some missing bits.

* prefer nameof(x) over literal "x"
2018-03-07 20:43:10 +10:00
Jordan Brown 3ec01bd05a Adds PullRequestReviewEventPayload (#1767)
* Adds PullRequestReviewEventPayload

* Remove random A
2018-02-25 20:18:26 +10:00
Ryan Gribble c4774ffaf0 Release v0.29 - This Looks Serious (TLS) (#1765)
* Add release notes

* Fix failing integration test

* Run FormatCode build task to tidy up whitespace

* Remove "UnkownUser" from release notes contributors
2018-02-18 20:36:49 +10:00
Ryan Gribble 41b4059c11 Deserializer should handle nullable StringEnum<T> (#1760)
* add deserializer tests for nullable enums, StringEnum and nullable StringEnum properties

* Fix deserializing nullable structs by using the underlying type when nullable

* StringEnum<T> should behave like an enum, returning default(T) when it is uninitialised/null/blank

* Don't allow null to be passed into StringEnum ctor - if it needs to be null then it should be declared as nullable

* fix expected json

* move logic to determine if property is a StringEnum<T> into helper function

* serializer needs to treat StringEnum<T> specially by serializing the enum value according to existing serializer strategy (parameter attributes and so on)

* remove fallback to default(T)

* add test to assert ctor throws exception when null passed in

* remove test for default(T) fallback behaviour

* Fix exception in serializer test - StringEnum property must be initialized otherwise an exception is thrown when attempting to serialize

* Dont allow empty strings either
2018-02-16 20:12:44 +10:00
Ryan Gribble b35b60f24c Add TLS1.2 to enabled security protocols (.NET Framework 4.5 only) (#1758)
* Add Tls1.2 to allowed protocols, for earlier target frameworks where this wasnt already the default.
ServicePointManager class used to do this, is only available in the full framework, so a preprocessor constant needs to be used

* intergration tests net452 target wasn't setup

* Use OR Assignment operator, just for Haacked
2018-02-14 00:30:25 +10:00
Dave Glick bf0688517f Refactors GitHubSerializerStrategy to be thread-safe (#1683) (#1748) 2018-01-31 22:06:37 +10:00
Thomas Hughes 81635c6dfe Fixes #1750, changing description of productInformation param for clarity (#1751)
* Updated GitHubClient.cs XML Docs to match dev docs.

* Updated Connection.cs XML Docs to match dev docs.

* Updated ProductHeaderValue.cs XML Docs to match GitHub dev docs.

* Updated EnterpriseProbe.cs XML Docs to match GitHub dev docs.

* Updated GitHubClient.cs XML Docs to match GitHub dev docs, corrected grammar issue.

* Updated Connection.cs XML Docs to match GitHub dev docs, corrected grammar issue.

* Updated ProductHeaderValue.cs XML Docs to match GitHub dev docs, corrected grammar issue.

* Removed my tabs, replaced with spaces to match format.

* Removed tabs again

* There seems to be some kind of bug where tabs are being shown though my local editor show none, so I'm submitting a bug to GitHub.com and editing in-browser to fix.

* Update GitHubClient.cs

* There seems to be some kind of bug where tabs are being shown though my local editor show none, so I'm submitting a bug to GitHub.com and editing in-browser to fix.

* Update Connection.cs

* There seems to be some kind of bug where tabs are being shown though my local editor show none, so I'm submitting a bug to GitHub.com and editing in-browser to fix.

* Change a couple of tabs to spaces

* tabs to spaces

* tabs to spaces
2018-01-31 22:03:51 +10:00
Itai Bar-Haim 9a29aa4f2f Add support for StatusEventPayload (#1732)
* added support for StatusEventPayload

* Added test for StatusEventPayload and fixed serializer to return that event payload type.
2018-01-09 12:38:38 +10:00
Philippe Miossec c8ff57b24c Add possibility to configure GitHubClient timeout (#963) (#1693)
* Add possibility to configure GitHubClient timeout (#963)

A first attempt to fix the problem describe in #963 by adding a possibility
to extend the default timeout value (100s)
that is too short to be able to post assets in github release.

* Rename to SetRequestTimeout
Make comments consistent
2017-10-29 10:51:37 +10:00
Ryan Gribble 366ac261bf Fix assembly versioning/properties and handle platform exception (#1660)
* Use assembly version instead of hard-coded ones

Builds happening on AppVeyor specify the assembly version with `dotnet build /p:Version=<gitversion>`

* Set default version for dev time

This is to avoid that the default 1.0.0 version be assigned to the assemblies

* Move various package/assembly properties from AssemblyInfo into csproj files so dotnet build can set them all

* Get rid of SolutionInfo and move assembly version function into Connection class

* Rework FormatUserAgent to use InformationalVersion and guard against exceptions determining platform OS/arch (fixes #1617)

* Update assembly descriptions

* Reword dotnetcore to .NET Core

* Attempted workaround for package version dependency issue by specifying version on dotnet restore
see https://github.com/NuGet/Home/issues/4337
2017-09-03 11:50:20 +10:00
Henrik Andersson 1d1ca0a572 Add client for organization outside collaborators (#1639)
* Add client for organization outside collaborators

* Add unit/integration tests

* Add methods for removing an outside collaborator

* Add unit/integration tests

* Add new Put method to Connection which accepts a preview header

* Add methods for converting an org member to an outside collaborator

* Fix copy paste errors in new exceptions

* According to API docs, a 403 should be returned if the member is not a member of the org, but a 404 is actually returned

* Add unit/integration tests

* Remove unused using directives

* Got a bit overzealous with my removal of using directives

* Fix integration tests by using the configured Organization and test username rather than henrik's :)

* Remove ApiOptions overloads as it isn't currently supported

* Fix XML doc grammar

* Fix failing unit tests

* Missed a couple of nameof replacements
2017-08-07 10:20:57 +10:00
Martin Scholz 329ef960ed [WIP] Add new Project API Preview (#1480)
Add Projects API client (preview)
2017-07-23 08:18:34 +10:00
Kristian Hellang 5ee4d64046 Add StringEnum to handle unknown enum values returned from API (#1595)
* Added StringEnum<TEnum>

* Added tests

* Make sure the serializer can work with StringEnum

* Use StringEnum for EventInfo.Event

* Add convention test to assert that all Response models use StringEnum<> to wrap enum properties

* Add Stringnum<> to all response types failing convention test

* Handle StringEnum to Enum conversion when Issue response model populates IssueUpdate request model

* Fix unit test

* Refactor SimpleJsonSerializer to expose the DeserializeEnum strategy so it can be used in StringEnum class

* Need to expose/use SerializeEnum functionality too, so we use the correct string representation of enum values that have custom properties (eg ReactionType Plus1 to "+1")

* fix unit tests, since the string is now the "correct" upstream api value

* Add a couple of tests for the Enum serialize/deserialize when underscores, hyphens and custom property attributes are present

* Compare parsed values for equality

* add convention test to ensure enum members all have Parameter property set

* update test to cover implicit conversions too

* this test should work but fails at the moment due to magic hyphen removal in deserializer causing a one way trip from utf-8 to EncodingType.Utf8 with no way to get back

* (unsuccesfully) expand event info test to try to catch more cases of unknown event types

* fix broken integration test while im here

* Fixed build errors after .NET Core merge

* Value -> StringValue, ParsedValue -> Value

* Don't allow StringValue to be null

* Ignore enums not used in request/response models

* Added ParameterAttribute to almost all enum values

* Ignore Language enum

* Fix failing tests

* Fix milestone sort parameter and tests

* whitespace

* fix milestone unit tests

* Fix StringEnum.Equals ... This could've been embarrassing!

* Change SimpleJsonSerializer Enum handling to only use `[Parameter()]` attributes (no more magic removal of hyphen/underscores from strings)

* Tidy up this integration test while im here

* Only test request/response enums in convention test

* Keep skipping Language

* Remove unused method

* Remove excluded enum types

* Removed unnecessary ParameterAttributes

* Remove unused enum

* Add StringEnum test for string-comparison of two invalid values

* Bring back IssueCommentSort and use it in IssueCommentRequest

This reverts commit 38a4a291d1476ef8c992fe0f76956974b6f32a49.

* Use assembly instead of namespace for Octokit check

* Add failing test to reproduce the issue where only the first enum paramter/value was added to the cache

* Fix deserializer enum cache to include all enum members rather than only the first member encountered

* Use a static SimpleJsonSerializer in StringEnum

* Remove serializer instance in StringEnum

* Add some documentation on StringEnum<TEnum>

* Fix parameter value to resolve failing integration test
2017-06-25 19:29:57 +10:00
Mickaël Derriey 9c80b00e6f Merge master into dotnetcore (#1599)
* bugfix - PUT should have a payload for Mark as Read (#1579)

* bugfix - PUT should have a payload for Mark as Read

* also fix the Observable client test

* add integration tests for MarkRead methods

* Fixup MarkReadForRepository methods to specify a body in the PUT request

* Fix unit tests for regular and observable client

* helps if the new files are included in the test project :)

* Cloning ApiInfo object should work when some fields are null (#1580)

* Adjust ApiInfo.Clone() to work even if some elements (eg ETag) are null

* Remove c# 6 language feature and do it the old school way

* Add a test for cloning ApiInfo when some fields are null

* The 3 lists can never be null anyway so remove some un-needed statements

* Add test for null RateLimit

* Remove Rx-Main dependency from samples
This resolves #1592 - LINQPad doesn't understand how to restore this unlisted package and it's not actually needed in the samples.

* Adding RemovedFromProject and other missing EventInfoState types. (#1591)

* Adding missing review types to event info.

* Fixing whitespace.

* Reword `BaseRefChanged` comment

* Adding missing event types.

* Change response models 'Url' properties from `Uri` to `string` (#1585)

* Add convention test to ensure 'Url' properties are of type string

Closes #1582

* Change 'Url' properties from Uri to string

Global Find/Replace FTW!

* fix compilation errors in the integration tests project

* Extend 'Url' properties type check to request models

* Stick to convention tests naming convention

* Remove unused using directives in models

Changing from `Uri` to `string` means the `using System;`
directive was not needed anymore in some files

* Update exception message wording

* empty commit to trigger a new build - hopefully Travis passes

* add convention test to ensure request models have Uri 'Url' properties

* make request models 'Url' properties Uri

fix typo in convention test name

* revert some request models 'Url' properties as `string`

see https://github.com/octokit/octokit.net/pull/1585#issuecomment-297186728

* Change test so that all model types must have 'Url' properties of type string

 - Filter test input to only get types which have 'Url' properties
 - Merge response and request model types tests into one
 - Unparameterize the exception since we only check for the string type now

* Fix string.Format tokens

If this PR doesn't get rebased, it'll be my wall of shame FOREVER!

* and then it's even more embarrassing when the commit message says rebased but you really meant squashed

* Remove exclusion of `Release` from request models
2017-05-02 21:55:30 +10:00
Mickaël Derriey 13d5dab516 Port to .NET Core (#1503)
Port to .NET Core
2017-01-21 14:42:02 +10:00
Ryan Gribble 3c818934b8 Release v0.24 - A Sight For Sore Eyes (#1539)
* Add release notes and bump version to 0.24

* run "build FormatCode" to fix up whitespace/formatting issues

* Fix failing Ssh key tests due to "validation exception".  This key must be in use on github (under another user, most likely from these tests failing).  Changed to a new SSH key and tweaked tests to reduce chance of a key being created and not destroyed

* Assignee and Assignees cant both be specified on NewIssue.  We missed this one in the PR.  Marked Assignee as [Obsolete] and fixed tests to use Assignees

* Fix a couple of Reactions tests that were calling the wrong client methods

* Fix timeline tests - looks like the response class has changed shape a bit, it now has an Issue object in the payload and Id field isnt present (leaving Id field there in case other timeline events do use it)

* Fix some following tests that require the test user to follow more than 1 other user

* Unskip these Event tests now because apparently they work!

* add breaking changes notes

* Update ApiErrorMessageSafe to return null for empty and whitespace strings (#1540)

* return null if ApiError.Message is empty or whitespace

* Uncomment test, which now passes

* update release notes to include PR1540

* Add "Bot" AccountType, was causing a deserialization exception when running the integration test "SearchForExcludedLanguage" (#1541)

* Update to include PR1541

* add bullets to make release notes easier to read

* markup additional code mentions in notes

* Fix grammar

fields => field
2017-01-17 18:56:55 +10:00
Sean Killeen 4cec3a6532 Introduce AbuseException (#1528)
* Add some tests to be completed

* Actually fail the tests

* Create AbuseException class

Copied from ForbiddenException and then gone over to inherit from it.

* Actually add AbuseException to csproj

* Update test file

* Ran .\build FixProjects

* Test updates

* Default message update for AbuseException

* Separate the exception creation logic

* Remove message assertion -- doesn't matter here

* Additional test for abuse message

* Remove unnecessary variable assignment

* Failing test for unsafe request

* Attempt to fix test

Still broken -- I don't think empty strings count to trigger the default
message

* Remove test that will always fail due to another issue

Opened #1529 to explore this.

* New tests (some failing)

* Passing tests are, like, better than failing tests.

* Last passing test

* Cleanup

* Add test for zero value and fix code

Lol boundary cases.

* cleanup

* Mark ParseRetryAfterSeconds as static

* Add GetObjectData override to AbuseException

To include data for RetryAfterSeconds variable, and satisfy the build
check.

* Add back failing test & skip it

* Change to nullable int with null default

* Fix tests around nullable default

* whitespace fixes

* Compact the logic; tests still pass

* Invert the if statements for compactness / clarity

* Test subclasses & reformatting

* Test name changes

* Whitespace fix

* Remove redundant line
2017-01-12 07:30:43 +10:00
Martin Scholz b4fad9bfab Add multiple assignees to issues (#1339)
* [WIP]

* add new method to add assignees for an issue

* added new overloads

* added unit tests

* fixed missed overload calls

* fixed inconsistency in tests

* added integration tests

* fixed errors in tests

* fixed all remarks

* added new overloads

* added unit tests

* added integration tests

* fixed incorrect variable names

* added new overloads

* added unit tests

* added itegration tests

* fixed integration tests

* removed extra empty lines

* fixed errors in unit tests

* added overloads on IObservableReleasesClient and IReleasesClient

* added new unit tests

* added integration tests

* added Task as return value of unit tests

* added Task as return parameter

* added return value ReleasesClientTests

* another try to get tests work

* another one try

* undo prev commit

* fixed errors in tests

* removed extra ThrowsAsync checks

* added new overloads

* added unit tests

* added integration tests

* added integration tests

* Add ApiOptions overloads to IWatchedClient + tests.

* Add ApiOptions overloads to IObservableWatchedClient + tests.

* More tests.

* fixed error in ObservableWatchedClient

* added unit tests

* added integration tests

* added new overloads

* added unit tests

* added integration tests

* renamed "Ensures" methods to deliver more consistency in code

* fixed failed tests

* Add ApiOptions overloads to methods on I(Observable)IssuesLabelsClient (#1329)

* correcting a couple of tests (#1331)

* Add ApiOption overloads to methods on I(Observable)OrganizationsClient (#1324)

* Add ApiOptions overloads to methods on I(Observable)OrganizationMembersClient (#1332)

* fix description

* add new response for IssueAssignees

* add constructor for IssueAssignees

* add debugger display for NewAssignees

* add methods for observable assignees client; new unit tests

* add observable unit tests for add method

* place AddAssignees under IssueClient

* fix description

* [WIP] add generic delete method

* revert add assignees

* add assignees key under issue client

* remove IssueAssignees dependencies

* fix type IssueAssignees

* add remove method for issue assignees; finish generic delete method

* unit tests for remove assignees

* Add Assignees property to NewIssue and UpdateIssue requets
Add Asignees property to Issue response
Removed [SerializeNull] attribute from UpdateIssue.Assignee as this was causing it to remove assignee when none was specified
Add a couple of integration tests to prove Assignees are being deserialised

* rename NewAssignees to AssignessUpdate

* change Assignees key description

* check null Issue.ToUpdate method

* add accept header for IssuesClientTests

* Fix some more unit tests

* add integration test

Check if an assignee was added to an issue

* fix merge conflicts

* resolve conflicts

* implement some hints from @ryangribble

* resolve merge fixes

* clean up

* some more changes

* create new repo

Create a new repo for integrationtest
'CanRetrieveIssuesWithMultipleAssignees()'

* fix merge

* fix conflicts

* fix xml

* change test

* change delete overloads

* Fix tests

* fix xml

* Add helper function RemoveLabel

* Add helper function RemoveAssignee

* Format last commit

* Add integration tests to exercise new Assignees field on IssueUpdate

* GitHub API doesnt allow Assignee and Assignees properties to both be specified - API docs say that Assignee is deprecated so mark it [Obsolete] and dont populate it in Issue.ToUpdate()

* Add Assignees field to PullRequest response object, and integration tests to verify it is populated.
This field is not listed in the API docs but probing the API revealed it is included in payloads

* add a couple of extra tests to verify the IssueUpdate.Labels is working correctly

* Include assignees in ctor for consistency

* fix IssueUpdate test for new Assignees field
2017-01-11 22:53:41 +10:00
Mordechai Zuber 4be25ba8bd Add missing SecurityCritical attribute
Fixes #1471
2016-10-13 15:54:27 +03:00
zzzprojects 82dfabefa7 Fixing Async Deadlock
Adding missing ConfigureAwait + put on single line await &
ConfigureAwait
2016-10-03 11:24:07 -04:00
Martin Scholz 93ae832311 [WIP] Protected branches updates - granular methods (#1443)
* Add get method for required status checks

* Add api urls for required status checks

* change name of apir url for required status checks

* fix xml comment

* add update method for required status checks

* add delete method for required status checks

* fix api url

* fix xml comment

* add api url for required status cehcks contexts

* add get method for required status checks contexts

* add replace method for required status checks contexts

* add add method for required status checks contexts

* add new overload for delete method

* add delete method for required status checks contexts; fix overloads for delete

* add api url for restrictions

* add get method for restrictions

* add delete method for restrictions

* add api url for teams restrictions

* add get method for team restrictions; fix delete method restrictions

* fix overhead for get team restrictions

* fix httpmethod for update required status checks

* add set method for team restrictions

* add add method for team restrictions

* add delete method for team restrictions

* add api url for user restrictions

* add get method for user restrictions

* add set method for user restrictions

* add add method for user restrictions

* add delete method for user restrictions

* Add unit test; fix api urls

* Add ExcludeFromTest class

* add exclude attribute to methods

* Add attribute usage

* Add parameter to interface

* add observable unit tests

* rename excludefromtest

exclude all the tests for the new api endpoints because they broke the
pagination and syncobsverable tests.

* rename excludefromattribute

* refactor observable methods

* [WIP] Add integration tests

* finish integration test

* fix renamed branch protection restrictions

* add team and user collections

* rename set to update

* rename test methods

* optimize integration tests

* made some tidy ups
- fixup comment wording Edit => Replace
- remove spurious characters from description
- remove un-needed exclude attributes

* remove ForOrgRepo tests

* remove unused org contexts

* dispose contexts

* remove obsolete GetRedirect

* add clarifying comment to restriction methods
2016-09-21 07:16:51 +10:00
Ryan Gribble 9d22ed4b1c Remove previously obsoleted IConnection.GetRedirect and IApiConnection.GetRedirect methods 2016-09-06 23:13:51 +10:00
Martin Scholz 5b9e23c2fb Fix timeout getting multiple repositories (#1411)
* add test

* [WIP]

* put logic for redirects outside of delegating handler

* change send method

* format code

* reorganized http client adapter

* change HttpClientAdapter

* rework http redirect tests - still an issue with accessing the response.RequestMessage.Content property as it is disposed

* remove some unused lines in httpclientadapter

* Reworked redirect implementation to fully clone http request and re-use it later
Now the skipped test from #874 works!
Also had to fix the new ReturnsRenamedRepository test as the ionide repo was renamed again
2016-08-15 06:57:50 +10:00
Martin Scholz 89500f4b8a Repository invitations changes (#1410)
* add invitations accept header

* create class RepositoryInvitation

* add repository invitations client

* add api urls for invitations

* [WIP]

* add methods to repository invitations client

* add invite method to repo collaborators client

need to add some new overload to post method in apiconnection

* some changes

* add observable client

* add dependings

* add missing observable client

* add missing xml params

* check client

* change repository invitation model

* [WIP] tests

* [WIP] tests; fix overloads for client

* change GetAllForCurrent; suppress message

* some more tests

* [WIP]

* [WIP]

* add collaborator request model

* change return types

change return types for invitation methods. add permission attribute for
repository collaborators invite method.

* add some more tests

* fix xml doc

* check for null arguments

* fix tests

* some fixes from @ryangribble

* add parameterless constructor for RepositoryInvitation

* change setter

* change constructor

* fix merge conflicts

* [WIP] RepositoryInvitationsClientTests

* fix api url xml

* change collaborator request constructor

* change unit tests for collaborator request

* change repocollaboratorsclient

change overloads for add in invite methods to set permissions

* [WIP] integration tests

* add methods for interface

* NotFoundExceptions

* add overload for invite method

* rename repo property

* gramar

* overloads for observable repo collaborators client

* change integration tests

* new integration tests

* add decline test

* add test for accept invitation
2016-07-23 18:50:22 +10:00
Martin Scholz d650f2a406 [WIP] deserialization 2016-06-27 09:15:26 +02:00
Martin Scholz 63629d5029 add method to check attributes 2016-06-24 10:36:00 +02:00
Martin Scholz 844be5586d revert NewReaction client and fix SimpleJsonSerializer 2016-06-23 09:45:22 +02:00
Martin Scholz d700433440 change NewReaction
change NewReaction to inherit from RequestParamaters. Change all
reaction clients.
2016-06-22 13:02:54 +02:00
Martin Scholz 4c05be81d4 fix deserialization of enums with custom attributes 2016-06-22 11:44:20 +02:00
Martin Scholz c1a16ffc74 get customAttribute for netfx 2016-06-21 19:40:16 +02:00
Martin Scholz ac14c5e1a2 fix serialization of enum values 2016-06-21 18:34:27 +02:00