[FEAT] Implement GetAllOrganizationMembershipsForCurrent (#2654)

This commit is contained in:
Lian Duan
2023-03-10 19:42:42 +01:00
committed by GitHub
parent 7f11726852
commit ddb66ed712
6 changed files with 141 additions and 0 deletions

View File

@@ -363,5 +363,28 @@ namespace Octokit.Reactive
/// <param name="options">Options to change API behaviour</param>
/// <returns></returns>
IObservable<OrganizationMembershipInvitation> GetAllFailedInvitations(string org, ApiOptions options);
/// <summary>
/// Returns all <see cref="OrganizationMembership" />s for the current user.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user">API Documentation</a>
/// for more information.
/// </remarks>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns></returns>
IObservable<OrganizationMembership> GetAllOrganizationMembershipsForCurrent();
/// <summary>
/// Returns all <see cref="OrganizationMembership" />s for the current user.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user">API Documentation</a>
/// for more information.
/// </remarks>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <param name="options">Options to change API behaviour</param>
/// <returns></returns>
IObservable<OrganizationMembership> GetAllOrganizationMembershipsForCurrent(ApiOptions options);
}
}

View File

@@ -506,5 +506,34 @@ namespace Octokit.Reactive
return _connection.GetAndFlattenAllPages<OrganizationMembershipInvitation>(ApiUrls.OrganizationFailedInvitations(org), null, options);
}
/// <summary>
/// Returns all <see cref="OrganizationMembership" />s for the current user.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user">API Documentation</a>
/// for more information.
/// </remarks>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <returns></returns>
public IObservable<OrganizationMembership> GetAllOrganizationMembershipsForCurrent()
{
return _connection.GetAndFlattenAllPages<OrganizationMembership>(ApiUrls.UserOrganizationMemberships());
}
/// <summary>
/// Returns all <see cref="OrganizationMembership" />s for the current user.
/// </summary>
/// <remarks>
/// See the <a href="https://docs.github.com/en/rest/orgs/members#list-organization-memberships-for-the-authenticated-user">API Documentation</a>
/// for more information.
/// </remarks>
/// <exception cref="ApiException">Thrown when a general API error occurs.</exception>
/// <param name="options">Options to change API behaviour</param>
/// <returns></returns>
public IObservable<OrganizationMembership> GetAllOrganizationMembershipsForCurrent(ApiOptions options)
{
return _connection.GetAndFlattenAllPages<OrganizationMembership>(ApiUrls.UserOrganizationMemberships(), options);
}
}
}