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

feat: add all missing APIs for all objects: group, model, adapter, enforcer, etc. #92

Merged
merged 3 commits into from
Feb 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorAccountClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,12 @@ public interface ICasdoorAccountClient
public Task<CasdoorLdapUsers?> GetLdapUsersAsync(string owner, string id, CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> UpdateLdapAsync(string id, CasdoorLdap ldap, CancellationToken cancellationToken = default);

public Task<CasdoorAccount?> GetAccountAsync(CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> ResetEmailOrPhoneAsync(CasdoorResetEmailOrPhoneForm casdoorResetEmailOrPhoneForm, CancellationToken cancellationToken = default);

public Task<CasdoorLaravelResponse?> User(CancellationToken cancellationToken = default);

public Task<CasdoorUserInfo?> UserInfo(CancellationToken cancellationToken = default);
}
20 changes: 20 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorAdpaterClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Casdoor.Client;

namespace Casdoor.Client;

public interface ICasdoorAdapterClient
{
public Task<CasdoorResponse?> AddAdapterAsync(CasdoorAdapter adapter, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateAdapterAsync(CasdoorAdapter adapter, IEnumerable<string> propertyNames, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateAdapterColumnsAsync(CasdoorAdapter adapter, IEnumerable<string>? columns, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeleteAdapterAsync(string owner, string name, CancellationToken cancellationToken = default);
public Task<CasdoorAdapter?> GetAdapterAsync(string owner, string name, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorAdapter>?> GetAdaptersAsync(string owner, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorAdapter>?> GetPaginationAdaptersAsync(string owner, int pageSize, int p,
List<KeyValuePair<string, string?>>? queryMap, CancellationToken cancellationToken = default);
}
25 changes: 25 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorCertClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorCertClient
{
public Task<CasdoorResponse?> AddCertAsync(CasdoorCert cert, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateCertAsync(CasdoorCert cert, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeleteCertAsync(string name, CancellationToken cancellationToken = default);
public Task<CasdoorCert?> GetCertAsync(string name, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorCert>?> GetCertsAsync(CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorCert>?> GetGlobalCertsAsync(CancellationToken cancellationToken = default);
}
6 changes: 4 additions & 2 deletions src/Casdoor.Client/Abstractions/ICasdoorClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@
namespace Casdoor.Client;

public interface ICasdoorClient :
ICasdoorUserClient, ICasdoorTokenClient, ICasdoorResourceClient, ICasdoorServiceClient,
ICasdoorUserClient, ICasdoorTokenClient, ICasdoorResourceClient, ICasdoorServiceClient, ICasdoorWebhookClient,
ICasdoorApplicationClient, ICasdoorOrganizationClient, ICasdoorProviderClient, ICasdoorAccountClient, ICasdoorModelClient,
ICasdoorEnforcerClient, ICasdoorGroupClient, ICasdoorPlanClient
ICasdoorEnforcerClient, ICasdoorGroupClient, ICasdoorPlanClient, ICasdoorSyncerClient, ICasdoorSubscriptionClient, ICasdoorPermissionClient,
ICasdoorAdapterClient, ICasdoorCertClient, ICasdoorPaymentClient, ICasdoorPricingClient, ICasdoorProductClient, ICasdoorSessionClient,
ICasdoorRoleClient, ICasdoorRecordClient
{

}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,5 @@ public interface ICasdoorOrganizationClient
public Task<CasdoorResponse?> UpdateOrganizationAsync(string id, CasdoorOrganization newOrganization, CancellationToken cancellationToken = default);
public Task<CasdoorOrganization?> GetOrganizationAsync(string id, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorOrganization>?> GetOrganizationsAsync(string owner, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorOrganization>?> GetOrganizationNamesAsync(string owner, CancellationToken cancellationToken = default);
}
29 changes: 29 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorPaymentClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorPaymentClient
{
public Task<CasdoorResponse?> AddPaymentAsync(CasdoorPayment payment, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdatePaymentAsync(CasdoorPayment payment, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> NotifyPaymentAsync(CasdoorPayment payment, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> InvoicePaymentAsync(CasdoorPayment payment, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeletePaymentAsync(CasdoorPayment payment, CancellationToken cancellationToken = default);
public Task<CasdoorPayment?> GetPaymentAsync(string name, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorPayment>?> GetUserPaymentsAsync(string userName,CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorPayment>?> GetPaymentsAsync(CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorPayment>?> GetPaginationPaymentsAsync(int pageSize, int p,
List<KeyValuePair<string, string?>>? queryMap, CancellationToken cancellationToken = default);
}
28 changes: 28 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorPermissionClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorPermissionClient
{
public Task<CasdoorResponse?> AddPermissionAsync(CasdoorPermission permission, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeletePermissionAsync(CasdoorPermission permission, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdatePermissionAsync(CasdoorPermission permission, string permissionId,
CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdatePermissionAsyncForCoulums(CasdoorPermission permission, IEnumerable<string>? columns,
CancellationToken cancellationToken = default);
public Task<CasdoorPermission?> GetPermissionAsync(string id, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorPermission>?> GetPermissionsAsync(string owner, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorPermission>?> GetPermissionsByRoleAsync(string name, string? owner = null, CancellationToken cancellationToken = default);
}
26 changes: 26 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorPricingClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorPricingClient
{
public Task<CasdoorResponse?> AddPricingAsync(CasdoorPricing pricing, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdatePricingAsync(CasdoorPricing pricing, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeletePricingAsync(CasdoorPricing pricing, CancellationToken cancellationToken = default);
public Task<CasdoorPricing?> GetPricingAsync(string name, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorPricing>?> GetPricingsAsync(CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorPricing>?> GetPaginationPricingsAsync(int pageSize, int p,
List<KeyValuePair<string, string?>>? queryMap, CancellationToken cancellationToken = default);
}
27 changes: 27 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorProductClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;
public interface ICasdoorProductClient
{
public Task<CasdoorResponse?> AddProductAsync(CasdoorProduct product, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateProductAsync(CasdoorProduct product, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeleteProductAsync(CasdoorProduct product, CancellationToken cancellationToken = default);
public Task<CasdoorProduct?> GetProductAsync(string name, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorProduct>?> GetProductsAsync(CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorProduct>?> GetPaginationProductsAsync(int pageSize, int p,
List<KeyValuePair<string, string?>>? queryMap, CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> BuyProductAsync(string name, string providerName, CancellationToken cancellationToken = default);
}
26 changes: 26 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorRecordClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorRecordClient
{
public Task<CasdoorResponse?> AddRecordAsync(CasdoorRecord record, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateRecordAsync(CasdoorRecord record, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeleteRecordAsync(CasdoorRecord record, CancellationToken cancellationToken = default);
public Task<CasdoorRecord?> GetRecordAsync(string name, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorRecord>?> GetRecordsAsync(CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorRecord>?> GetPaginationRecordsAsync(int pageSize, int p,
List<KeyValuePair<string, string?>>? queryMap, CancellationToken cancellationToken = default);
}
9 changes: 9 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorResourceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,13 @@ public interface ICasdoorResourceClient
Stream fileStream, string createdTime = "", string description = "", CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> DeleteResourceAsync(string name, CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> AddResourceAsync(CasdoorUserResource casdoorUserResource, CancellationToken cancellationToken = default);

public Task<CasdoorUserResource?> GetResourceAsync(string name, CancellationToken cancellationToken = default);

public Task<IEnumerable<CasdoorUserResource>?> GetResourcesAsync(string owner, string user,
string field, string value, string sortField, string sortOrder, CancellationToken cancellationToken = default);

public Task<IEnumerable<CasdoorUserResource>?> GetPaginationResourcesAsync(string owner, string user, int pageSize, int p, string field, string value, string sortField, string sortOrder, CancellationToken cancellationToken = default);
}
26 changes: 26 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorRoleClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorRoleClient
{
public Task<CasdoorResponse?> AddRoleAsync(CasdoorRole role, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateRoleAsync(CasdoorRole role, string name, string? owner = null,
CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeleteRoleAsync(CasdoorRole role, CancellationToken cancellationToken = default);
public Task<CasdoorRole?> GetRoleAsync(string name, string? owner = null,
CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorRole>?> GetRolesAsync(string? owner = null, CancellationToken cancellationToken = default);
}
2 changes: 2 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorServiceClient.cs
Original file line number Diff line number Diff line change
Expand Up @@ -20,4 +20,6 @@ public interface ICasdoorServiceClient

public Task<CasdoorResponse?> SendEmailAsync(string title, string content, string sender,
IEnumerable<string> receivers, CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> SendNotification(string content, CancellationToken cancellationToken = default);
}
27 changes: 27 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorSessionClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorSessionClient
{
public Task<CasdoorResponse?> AddSessionAsync(CasdoorSession session, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateSessionAsync(CasdoorSession session, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> UpdateSessionForColumnsAsync(CasdoorSession session,IEnumerable<string> columns, CancellationToken cancellationToken = default);
public Task<CasdoorResponse?> DeleteSessionAsync(CasdoorSession session, CancellationToken cancellationToken = default);
public Task<CasdoorSession?> GetSessionAsync(string name, string application, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorSession>?> GetSessionsAsync(CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorSession>?> GetPaginationSessionsAsync(int pageSize, int p,
List<KeyValuePair<string, string?>>? queryMap, CancellationToken cancellationToken = default);
}
32 changes: 32 additions & 0 deletions src/Casdoor.Client/Abstractions/ICasdoorSubscriptionClient.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// Copyright 2024 The Casdoor Authors. All Rights Reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

namespace Casdoor.Client;

public interface ICasdoorSubscriptionClient
{
public Task<CasdoorResponse?> AddSubscriptionAsync(CasdoorSubscription casdoorSubscription, CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> DeleteSubscriptionAsync(CasdoorSubscription casdoorSubscription, CancellationToken cancellationToken = default);

public Task<CasdoorSubscription?> GetSubscriptionAsync(string owner, string name, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorSubscription>?> GetPaginationSubscriptions(string owner, int p, int pageSize,
List<KeyValuePair<string, string?>> queryMap, CancellationToken cancellationToken = default);
public Task<IEnumerable<CasdoorSubscription>?> GetSubscriptionsAsync(string owner, CancellationToken cancellationToken = default);

public Task<CasdoorResponse?> UpdateSubscriptionAsync(CasdoorSubscription casdoorSubscription, CancellationToken cancellationToken = default);
}



Loading
Loading