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: impl bematch client #156

Merged
merged 3 commits into from
Jan 14, 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
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mutation CreateAppleSubscription($input: CreateAppleSubscriptionInput!) {
createAppleSubscription(input: $input)
}
3 changes: 3 additions & 0 deletions Packages/BeMatch/GraphQL/Mutations/CreateInvitation.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
mutation CreateInvitation($input: CreateInvitationInput!) {
createInvitation(input:$input)
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
query ActiveInvitationCampaign {
activeInvitationCampaign {
id
quantity
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
query ActivePremiumMemberships {
activePremiumMemberships {
id
expireAt
}
}
6 changes: 6 additions & 0 deletions Packages/BeMatch/GraphQL/Queries/InvitationCode.graphql
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
query InvitationCode {
invitationCode {
id
code
}
}
111 changes: 108 additions & 3 deletions Packages/BeMatch/GraphQL/schema.graphqls
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@
# THIS FILE WAS AUTOMATICALLY GENERATED (DO NOT MODIFY)
# ------------------------------------------------------

enum AppleSubscriptionEnvironment {
PRODUCTION
SANDBOX
}

type Banner {
buttonTitle: String!
description: String
Expand All @@ -16,11 +21,20 @@ type Banner {
url: String!
}

input CreateAppleSubscriptionInput {
environment: AppleSubscriptionEnvironment!
transactionId: String!
}

input CreateFirebaseRegistrationTokenInput {
"""registration token"""
token: String!
}

input CreateInvitationInput {
code: String!
}

input CreateLikeInput {
"""LIKEを送信する相手のID"""
targetUserId: String!
Expand All @@ -34,6 +48,14 @@ type CreateLikeResponse {
match: Match
}

input CreateMessageInput {
"""メッセージを送信する対象のユーザー"""
targetUserId: String!

"""メッセージ内容"""
text: String!
}

input CreateNopeInput {
"""NOPEを送信する相手のID"""
targetUserId: String!
Expand All @@ -58,6 +80,11 @@ input DeleteMatchInput {
targetUserId: String!
}

input DeleteMessageInput {
"""削除するメッセージのID"""
messageId: String!
}

type Feedback {
"""feedback type"""
feedbackType: FeedbackType!
Expand Down Expand Up @@ -134,16 +161,58 @@ type MatchEdge {
node: Match!
}

type Message {
"""When the message is created"""
createdAt: Date!

"""When the message is deleted by a user"""
deletedAt: Date

"""direct message id"""
id: ID!

"""When the message is read by a target user"""
readAt: Date

"""target user id"""
targetUserId: ID!

"""message content"""
text: String!

"""user id"""
userId: ID!
}

type MessageConnection {
edges: [MessageEdge!]!
pageInfo: PageInfo!
}

type MessageEdge {
cursor: String!
node: Message!
}

type Mutation {
"""アカウントを閉じる"""
closeUser: Boolean!

"""Appleの課金契約を記録する"""
createAppleSubscription(input: CreateAppleSubscriptionInput!): Boolean!

"""FirebaseのRegistrationTokenを作成する"""
createFirebaseRegistrationToken(input: CreateFirebaseRegistrationTokenInput!): FirebaseRegistrationToken!

"""招待を作成"""
createInvitation(input: CreateInvitationInput!): Boolean!

"""LIKEを作成する"""
createLike(input: CreateLikeInput!): CreateLikeResponse!

"""メッセージの作成"""
createMessage(input: CreateMessageInput!): Message!

"""NOPEを作成する"""
createNope(input: CreateNopeInput!): Feedback!

Expand All @@ -156,9 +225,15 @@ type Mutation {
"""マッチを削除する"""
deleteMatch(input: DeleteMatchInput!): Boolean!

"""メッセージの削除"""
deleteMessage(input: DeleteMessageInput!): Boolean!

"""Matchを既読にする"""
readMatch(matchId: String!): Match!

"""この mutation を呼ぶ前に作成されたメッセージすべてを既読にする"""
readMessages(input: ReadMessageInput!): Int!

"""BeRealのユーザー名を更新する"""
updateBeReal(input: UpdateBeRealInput!): User!

Expand All @@ -180,27 +255,52 @@ type PageInfo {
startCursor: String
}

type PremiumMembership {
expireAt: Date!
id: ID!
premiumKind: PremiumType!
}

enum PremiumType {
PRO
}

type PushNotificationBadge {
"""バッジ数"""
count: Int!
id: ID!
}

type Query {
"""招待キャンペーンを取得"""
activeInvitationCampaign: InvitationCampaign

"""期限内のメンバーシップを取得"""
activePremiumMemberships: [PremiumMembership!]!

"""バナー一覧"""
banners: [Banner!]!

"""ログイン中ユーザーを取得"""
currentUser: User!

"""招待キャンペーンを取得"""
invitationCampaign: InvitationCampaign

"""招待コードを取得"""
invitationCode: InvitationCode!

"""マッチ一覧"""
matches(after: String, first: Int!): MatchConnection!

"""特定のユーザーとのダイレクトメッセージ一覧"""
messagesWith(
after: String
first: Int!

"""メッセージ相手のユーザーID"""
targetUserId: ID!

"""自身のユーザーID"""
userId: ID!
): MessageConnection!
pushNotificationBadge: PushNotificationBadge!

"""自分の受け取ったLikeを取得する"""
Expand All @@ -210,6 +310,11 @@ type Query {
recommendations: [User!]!
}

input ReadMessageInput {
"""既読にするメッセージの送信ユーザーID"""
targetUserId: String!
}

type ReceivedLike {
"""受け取ったLike数"""
count: Int!
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// @generated
// This file was automatically generated and should not be edited.

@_exported import ApolloAPI

public extension BeMatch {
class CreateAppleSubscriptionMutation: GraphQLMutation {
public static let operationName: String = "CreateAppleSubscription"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation CreateAppleSubscription($input: CreateAppleSubscriptionInput!) { createAppleSubscription(input: $input) }"#
))

public var input: CreateAppleSubscriptionInput

public init(input: CreateAppleSubscriptionInput) {
self.input = input
}

public var __variables: Variables? { ["input": input] }

public struct Data: BeMatch.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }

public static var __parentType: ApolloAPI.ParentType { BeMatch.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("createAppleSubscription", Bool.self, arguments: ["input": .variable("input")]),
] }

/// Appleの課金契約を記録する
public var createAppleSubscription: Bool { __data["createAppleSubscription"] }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
// @generated
// This file was automatically generated and should not be edited.

@_exported import ApolloAPI

public extension BeMatch {
class CreateInvitationMutation: GraphQLMutation {
public static let operationName: String = "CreateInvitation"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"mutation CreateInvitation($input: CreateInvitationInput!) { createInvitation(input: $input) }"#
))

public var input: CreateInvitationInput

public init(input: CreateInvitationInput) {
self.input = input
}

public var __variables: Variables? { ["input": input] }

public struct Data: BeMatch.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }

public static var __parentType: ApolloAPI.ParentType { BeMatch.Objects.Mutation }
public static var __selections: [ApolloAPI.Selection] { [
.field("createInvitation", Bool.self, arguments: ["input": .variable("input")]),
] }

/// 招待を作成
public var createInvitation: Bool { __data["createInvitation"] }
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// @generated
// This file was automatically generated and should not be edited.

@_exported import ApolloAPI

public extension BeMatch {
class ActiveInvitationCampaignQuery: GraphQLQuery {
public static let operationName: String = "ActiveInvitationCampaign"
public static let operationDocument: ApolloAPI.OperationDocument = .init(
definition: .init(
#"query ActiveInvitationCampaign { activeInvitationCampaign { __typename id quantity } }"#
))

public init() {}

public struct Data: BeMatch.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }

public static var __parentType: ApolloAPI.ParentType { BeMatch.Objects.Query }
public static var __selections: [ApolloAPI.Selection] { [
.field("activeInvitationCampaign", ActiveInvitationCampaign?.self),
] }

/// 招待キャンペーンを取得
public var activeInvitationCampaign: ActiveInvitationCampaign? { __data["activeInvitationCampaign"] }

/// ActiveInvitationCampaign
///
/// Parent Type: `InvitationCampaign`
public struct ActiveInvitationCampaign: BeMatch.SelectionSet {
public let __data: DataDict
public init(_dataDict: DataDict) { __data = _dataDict }

public static var __parentType: ApolloAPI.ParentType { BeMatch.Objects.InvitationCampaign }
public static var __selections: [ApolloAPI.Selection] { [
.field("__typename", String.self),
.field("id", BeMatch.ID.self),
.field("quantity", Int.self),
] }

public var id: BeMatch.ID { __data["id"] }
/// 招待キャンペーンの発行数
public var quantity: Int { __data["quantity"] }
}
}
}
}
Loading