Skip to content

Commit fdc8cd2

Browse files
authored
Add membership and functionality to other services (#48)
1 parent 196678f commit fdc8cd2

File tree

262 files changed

+2767
-203
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

262 files changed

+2767
-203
lines changed

.github/workflows/publish.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,4 @@ jobs:
1616
run: cargo login ${{ secrets.CARGO_TOKEN }}
1717

1818
- name: publish
19-
run: cargo publish
19+
run: make publish

Cargo.toml

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ members = [
77
"core/lib/",
88
"core/line_liff",
99
"core/line_manage_audience",
10+
"core/line_membership",
1011
"core/line_messaging_api",
1112
"core/line_module",
1213
"core/line_module_attach",

Makefile

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
.PHONY: publish
2+
publish:
3+
cargo publish --manifest-path core/lib/Cargo.toml

core/lib/Cargo.toml

+7-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "line-bot-sdk-rust"
3-
version = "1.0.0"
3+
version = "1.0.1"
44
authors = ["nanato12 <[email protected]>"]
55
edition = "2021"
66
description = "LINE Messaging API SDK for Rust"
@@ -48,8 +48,12 @@ path = "../line_liff"
4848
version = "0.0.1"
4949
path = "../line_manage_audience"
5050

51-
[dependencies.line_messaging_api]
51+
[dependencies.line_membership]
5252
version = "0.0.1"
53+
path = "../line_membership"
54+
55+
[dependencies.line_messaging_api]
56+
version = "0.0.2"
5357
path = "../line_messaging_api"
5458

5559
[dependencies.line_module]
@@ -65,5 +69,5 @@ version = "0.0.1"
6569
path = "../line_shop"
6670

6771
[dependencies.line_webhook]
68-
version = "1.0.0"
72+
version = "1.0.1"
6973
path = "../line_webhook"

core/lib/src/client/mod.rs

+10
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ use line_liff::apis::{configuration::Configuration as LiffConfiguration, LiffApi
2727
use line_manage_audience::apis::{
2828
configuration::Configuration as ManageAudienceConfiguration, ManageAudienceApiClient,
2929
};
30+
use line_membership::apis::{
31+
configuration::Configuration as MembershipConfiguration, MembershipApiClient,
32+
};
3033
use line_messaging_api::apis::{
3134
configuration::Configuration as MessagingApiConfiguration, MessagingApiApiClient,
3235
};
@@ -48,6 +51,7 @@ pub struct LINE {
4851
pub insight_api_client: InsightApiClient<C>,
4952
pub liff_api_client: LiffApiClient<C>,
5053
pub manage_audience_api_client: ManageAudienceApiClient<C>,
54+
pub membership_api_client: MembershipApiClient<C>,
5155
pub messaging_api_client: MessagingApiApiClient<C>,
5256
pub module_api_client: LineModuleApiClient<C>,
5357
pub module_attach_api_client: LineModuleAttachApiClient<C>,
@@ -82,6 +86,11 @@ impl LINE {
8286
let manage_audience_api_client =
8387
ManageAudienceApiClient::new(Rc::new(manage_audience_conf));
8488

89+
// membership
90+
let mut membership_conf = MembershipConfiguration::new(client.clone());
91+
membership_conf.oauth_access_token = Some(token.to_owned());
92+
let membership_api_client = MembershipApiClient::new(Rc::new(membership_conf));
93+
8594
// messaging_api
8695
let mut messaging_api_conf = MessagingApiConfiguration::new(client.clone());
8796
messaging_api_conf.oauth_access_token = Some(token.to_owned());
@@ -112,6 +121,7 @@ impl LINE {
112121
insight_api_client,
113122
liff_api_client,
114123
manage_audience_api_client,
124+
membership_api_client,
115125
messaging_api_client,
116126
module_api_client,
117127
module_attach_api_client,

core/line_membership/Cargo.toml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
[package]
2+
name = "line_membership"
3+
version = "0.0.1"
4+
authors = ["OpenAPI Generator team and contributors"]
5+
description = "This document describes LINE Official Account Membership API."
6+
# Override this license by providing a License Object in the OpenAPI.
7+
license = "Unlicense"
8+
edition = "2018"
9+
10+
[dependencies]
11+
serde = "^1.0"
12+
serde_derive = "^1.0"
13+
serde_json = "^1.0"
14+
url = "^2.2"
15+
uuid = { version = "^1.0", features = ["serde", "v4"] }
16+
hyper = { version = "~0.14", features = ["full"] }
17+
hyper-tls = "~0.5"
18+
http = "~0.2"
19+
base64 = "~0.7.0"
20+
futures = "^0.3"

core/line_membership/README.md

+52
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
# Rust API client for line_membership
2+
3+
This document describes LINE Official Account Membership API.
4+
5+
6+
## Overview
7+
8+
This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [openapi-spec](https://openapis.org) from a remote server, you can easily generate an API client.
9+
10+
- API version: 0.0.1
11+
- Package version: 0.0.1
12+
- Build package: `org.openapitools.codegen.languages.RustClientCodegen`
13+
14+
## Installation
15+
16+
Put the package under your project folder in a directory named `line_membership` and add the following to `Cargo.toml` under `[dependencies]`:
17+
18+
```
19+
line_membership = { path = "./line_membership" }
20+
```
21+
22+
## Documentation for API Endpoints
23+
24+
All URIs are relative to *https://api.line.me*
25+
26+
Class | Method | HTTP request | Description
27+
------------ | ------------- | ------------- | -------------
28+
*MembershipApi* | [**get_membership_list**](docs/MembershipApi.md#get_membership_list) | **Get** /membership/v1/list |
29+
*MembershipApi* | [**get_membership_subscription**](docs/MembershipApi.md#get_membership_subscription) | **Get** /membership/v1/subscription/{userId} |
30+
31+
32+
## Documentation For Models
33+
34+
- [ErrorResponse](docs/ErrorResponse.md)
35+
- [GetMembershipSubscriptionResponse](docs/GetMembershipSubscriptionResponse.md)
36+
- [Membership](docs/Membership.md)
37+
- [MembershipListResponse](docs/MembershipListResponse.md)
38+
- [MembershipMeta](docs/MembershipMeta.md)
39+
- [MembershipUser](docs/MembershipUser.md)
40+
- [Subscription](docs/Subscription.md)
41+
42+
43+
To get access to the crate's generated documentation, use:
44+
45+
```
46+
cargo doc --open
47+
```
48+
49+
## Author
50+
51+
52+
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# ErrorResponse
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**message** | **String** | Error message |
8+
**details** | Option<**Vec<String>**> | | [optional]
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# GetMembershipSubscriptionResponse
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**subscriptions** | [**Vec<crate::models::Subscription>**](Subscription.md) | List of subscription information |
8+
9+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10+
11+
+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Membership
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**membership_id** | **i32** | Membership plan ID. |
8+
**title** | **String** | Membership plan name. |
9+
**description** | **String** | Membership plan description. |
10+
**benefits** | **Vec<String>** | List of membership plan perks. |
11+
**price** | **f64** | Monthly fee for membership plan. (e.g. 1500.00) |
12+
**currency** | **String** | The currency of membership.price. |
13+
**member_count** | **i32** | Number of members subscribed to the membership plan. |
14+
**member_limit** | Option<**i32**> | The upper limit of members who can subscribe. If no upper limit is set, it will be null. |
15+
**is_in_app_purchase** | **bool** | Payment method for users who subscribe to a membership plan. |
16+
**is_published** | **bool** | Membership plan status. |
17+
18+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
19+
20+
+67
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
# \MembershipApi
2+
3+
All URIs are relative to *https://api.line.me*
4+
5+
Method | HTTP request | Description
6+
------------- | ------------- | -------------
7+
[**get_membership_list**](MembershipApi.md#get_membership_list) | **Get** /membership/v1/list |
8+
[**get_membership_subscription**](MembershipApi.md#get_membership_subscription) | **Get** /membership/v1/subscription/{userId} |
9+
10+
11+
12+
## get_membership_list
13+
14+
> crate::models::MembershipListResponse get_membership_list()
15+
16+
17+
Get a list of memberships.
18+
19+
### Parameters
20+
21+
This endpoint does not need any parameter.
22+
23+
### Return type
24+
25+
[**crate::models::MembershipListResponse**](MembershipListResponse.md)
26+
27+
### Authorization
28+
29+
[Bearer](../README.md#Bearer)
30+
31+
### HTTP request headers
32+
33+
- **Content-Type**: Not defined
34+
- **Accept**: application/json
35+
36+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
37+
38+
39+
## get_membership_subscription
40+
41+
> crate::models::GetMembershipSubscriptionResponse get_membership_subscription(user_id)
42+
43+
44+
Get a user's membership subscription.
45+
46+
### Parameters
47+
48+
49+
Name | Type | Description | Required | Notes
50+
------------- | ------------- | ------------- | ------------- | -------------
51+
**user_id** | **String** | User ID | [required] |
52+
53+
### Return type
54+
55+
[**crate::models::GetMembershipSubscriptionResponse**](GetMembershipSubscriptionResponse.md)
56+
57+
### Authorization
58+
59+
[Bearer](../README.md#Bearer)
60+
61+
### HTTP request headers
62+
63+
- **Content-Type**: Not defined
64+
- **Accept**: application/json
65+
66+
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
67+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
# MembershipListResponse
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**memberships** | [**Vec<crate::models::Membership>**](Membership.md) | List of membership information |
8+
9+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
10+
11+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
# MembershipMeta
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**membership_id** | **i32** | Membership plan ID. |
8+
**title** | **String** | Membership plan name. |
9+
**description** | **String** | Membership plan description. |
10+
**benefits** | **Vec<String>** | List of membership plan perks. |
11+
**price** | **f64** | Monthly fee for membership plan. (e.g. 1500.00) |
12+
**currency** | **String** | The currency of membership.price. |
13+
14+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
15+
16+
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# MembershipUser
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**membership_no** | **i32** | The user's member number in the membership plan. |
8+
**joined_time** | **i32** | UNIX timestamp at which the user subscribed to the membership. |
9+
**next_billing_date** | **String** | Next payment date for membership plan. - Format: yyyy-MM-dd (e.g. 2024-02-08) - Timezone: UTC+9 |
10+
**total_subscription_months** | **i32** | The period of time in months that the user has been subscribed to a membership plan. If a user previously canceled and then re-subscribed to the same membership plan, only the period after the re-subscription will be counted. |
11+
12+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
13+
14+
+12
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Subscription
2+
3+
## Properties
4+
5+
Name | Type | Description | Notes
6+
------------ | ------------- | ------------- | -------------
7+
**membership** | [**crate::models::MembershipMeta**](MembershipMeta.md) | |
8+
**user** | [**crate::models::MembershipUser**](MembershipUser.md) | |
9+
10+
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)
11+
12+
+41
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright (C) 2016 LINE Corp.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
use std::rc::Rc;
18+
19+
use super::configuration::Configuration;
20+
use hyper;
21+
22+
pub struct APIClient {
23+
membership_api: Box<dyn crate::apis::MembershipApi>,
24+
}
25+
26+
impl APIClient {
27+
pub fn new<C: hyper::client::connect::Connect>(configuration: Configuration<C>) -> APIClient
28+
where
29+
C: Clone + std::marker::Send + Sync + 'static,
30+
{
31+
let rc = Rc::new(configuration);
32+
33+
APIClient {
34+
membership_api: Box::new(crate::apis::MembershipApiClient::new(rc.clone())),
35+
}
36+
}
37+
38+
pub fn membership_api(&self) -> &dyn crate::apis::MembershipApi {
39+
self.membership_api.as_ref()
40+
}
41+
}

0 commit comments

Comments
 (0)