Skip to content
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
22 changes: 22 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,28 @@ called out explicitly even when nothing else did.
release notes, so a version with no entry here does not release. Write the entry in the same PR that
syncs the contract, while the diff is still in front of you.

## 0.2.0

Synced to [`flipcash2-protobuf-api@0300d252`](https://github.com/code-payments/flipcash2-protobuf-api/commit/0300d252f35f3524e067aeef22382012c754902a).

### Added

- `SetMinDmChatInitFee` on the `profile.v1.Profile` service, setting the minimum fee another user
must pay to initialize a DM chat with the caller. `SetMinDmChatInitFeeRequest` takes the new fee as
a required `common.v1.FiatPaymentAmount` on field 1 and the usual required `common.v1.Auth` on
field 10. It replaces whatever fee was already set rather than merging into it.

`SetMinDmChatInitFeeResponse.Result` is a new enum: `OK`, `DENIED`, and `INVALID_AMOUNT`, the last
covering an unsupported currency or an amount outside the allowed range.

- `min_dm_chat_init_fee` on `profile.v1.UserProfile`, a `common.v1.FiatPaymentAmount` on field 10.
It is public, so it comes back for any user rather than only the caller, and it is unset when the
user has not set a fee, in which case the server default applies.

Nothing existing changed. No field number or enum value moved, and `SetMinDmChatInitFeeResponse.Result`
is a new enum rather than a case added to an existing one, so upgrading from `0.1.0` needs no consumer
changes.

## 0.1.0

First release. The Flipcash contract is now generated once here and published for both platforms,
Expand Down
21 changes: 20 additions & 1 deletion Sources/Flipcash2ClientProtocol/profile_v1_model.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,19 @@ public struct Flipcash_Profile_V1_UserProfile: Sendable {
/// Clears the value of `tipCardCustomization`. Subsequent reads from it will return its default value.
public mutating func clearTipCardCustomization() {self._tipCardCustomization = nil}

/// The minimum fee another user must pay to initialize a DM chat with this
/// user. Public, so it is returned for any user, not just the caller. Unset
/// when the user hasn't set one, in which case the server default applies.
/// Update it with SetMinDmChatInitFee.
public var minDmChatInitFee: Flipcash_Common_V1_FiatPaymentAmount {
get {return _minDmChatInitFee ?? Flipcash_Common_V1_FiatPaymentAmount()}
set {_minDmChatInitFee = newValue}
}
/// Returns true if `minDmChatInitFee` has been explicitly set.
public var hasMinDmChatInitFee: Bool {return self._minDmChatInitFee != nil}
/// Clears the value of `minDmChatInitFee`. Subsequent reads from it will return its default value.
public mutating func clearMinDmChatInitFee() {self._minDmChatInitFee = nil}

public var unknownFields = SwiftProtobuf.UnknownStorage()

public init() {}
Expand All @@ -126,6 +139,7 @@ public struct Flipcash_Profile_V1_UserProfile: Sendable {
fileprivate var _profilePicture: Flipcash_Blob_V1_Media? = nil
fileprivate var _joinTs: SwiftProtobuf.Google_Protobuf_Timestamp? = nil
fileprivate var _tipCardCustomization: Flipcash_Profile_V1_TipCardCustomization? = nil
fileprivate var _minDmChatInitFee: Flipcash_Common_V1_FiatPaymentAmount? = nil
}

public struct Flipcash_Profile_V1_SocialProfile: Sendable {
Expand Down Expand Up @@ -256,7 +270,7 @@ fileprivate let _protobuf_package = "flipcash.profile.v1"

extension Flipcash_Profile_V1_UserProfile: SwiftProtobuf.Message, SwiftProtobuf._MessageImplementationBase, SwiftProtobuf._ProtoNameProviding {
public static let protoMessageName: String = _protobuf_package + ".UserProfile"
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}display_name\0\u{3}social_profiles\0\u{3}phone_number\0\u{3}email_address\0\u{3}profile_picture\0\u{3}join_ts\0\u{3}tip_card_customization\0\u{1}username\0\u{3}user_id\0")
public static let _protobuf_nameMap = SwiftProtobuf._NameMap(bytecode: "\0\u{3}display_name\0\u{3}social_profiles\0\u{3}phone_number\0\u{3}email_address\0\u{3}profile_picture\0\u{3}join_ts\0\u{3}tip_card_customization\0\u{1}username\0\u{3}user_id\0\u{3}min_dm_chat_init_fee\0")

public mutating func decodeMessage<D: SwiftProtobuf.Decoder>(decoder: inout D) throws {
while let fieldNumber = try decoder.nextFieldNumber() {
Expand All @@ -273,6 +287,7 @@ extension Flipcash_Profile_V1_UserProfile: SwiftProtobuf.Message, SwiftProtobuf.
case 7: try { try decoder.decodeSingularMessageField(value: &self._tipCardCustomization) }()
case 8: try { try decoder.decodeSingularMessageField(value: &self._username) }()
case 9: try { try decoder.decodeSingularMessageField(value: &self._userID) }()
case 10: try { try decoder.decodeSingularMessageField(value: &self._minDmChatInitFee) }()
default: break
}
}
Expand Down Expand Up @@ -310,6 +325,9 @@ extension Flipcash_Profile_V1_UserProfile: SwiftProtobuf.Message, SwiftProtobuf.
try { if let v = self._userID {
try visitor.visitSingularMessageField(value: v, fieldNumber: 9)
} }()
try { if let v = self._minDmChatInitFee {
try visitor.visitSingularMessageField(value: v, fieldNumber: 10)
} }()
try unknownFields.traverse(visitor: &visitor)
}

Expand All @@ -323,6 +341,7 @@ extension Flipcash_Profile_V1_UserProfile: SwiftProtobuf.Message, SwiftProtobuf.
if lhs._profilePicture != rhs._profilePicture {return false}
if lhs._joinTs != rhs._joinTs {return false}
if lhs._tipCardCustomization != rhs._tipCardCustomization {return false}
if lhs._minDmChatInitFee != rhs._minDmChatInitFee {return false}
if lhs.unknownFields != rhs.unknownFields {return false}
return true
}
Expand Down
136 changes: 136 additions & 0 deletions Sources/Flipcash2ClientProtocol/profile_v1_profile_service.grpc.swift
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,18 @@ public enum Flipcash_Profile_V1_Profile {
method: "UpdateTipCard"
)
}
/// Namespace for "SetMinDmChatInitFee" metadata.
public enum SetMinDmChatInitFee {
/// Request type for "SetMinDmChatInitFee".
public typealias Input = Flipcash_Profile_V1_SetMinDmChatInitFeeRequest
/// Response type for "SetMinDmChatInitFee".
public typealias Output = Flipcash_Profile_V1_SetMinDmChatInitFeeResponse
/// Descriptor for "SetMinDmChatInitFee".
public static let descriptor = GRPCCore.MethodDescriptor(
service: GRPCCore.ServiceDescriptor(fullyQualifiedService: "flipcash.profile.v1.Profile"),
method: "SetMinDmChatInitFee"
)
}
/// Namespace for "LinkSocialAccount" metadata.
public enum LinkSocialAccount {
/// Request type for "LinkSocialAccount".
Expand Down Expand Up @@ -111,6 +123,7 @@ public enum Flipcash_Profile_V1_Profile {
SetUsername.descriptor,
SetProfilePicture.descriptor,
UpdateTipCard.descriptor,
SetMinDmChatInitFee.descriptor,
LinkSocialAccount.descriptor,
UnlinkSocialAccount.descriptor
]
Expand Down Expand Up @@ -247,6 +260,30 @@ extension Flipcash_Profile_V1_Profile {
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Flipcash_Profile_V1_UpdateTipCardResponse>) async throws -> Result
) async throws -> Result where Result: Sendable

/// Call the "SetMinDmChatInitFee" method.
///
/// > Source IDL Documentation:
/// >
/// > SetMinDmChatInitFee sets the minimum fee another user must pay to
/// > initialize a DM chat with the caller, replacing any fee already set.
///
/// - Parameters:
/// - request: A request containing a single `Flipcash_Profile_V1_SetMinDmChatInitFeeRequest` message.
/// - serializer: A serializer for `Flipcash_Profile_V1_SetMinDmChatInitFeeRequest` messages.
/// - deserializer: A deserializer for `Flipcash_Profile_V1_SetMinDmChatInitFeeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
func setMinDmChatInitFee<Result>(
request: GRPCCore.ClientRequest<Flipcash_Profile_V1_SetMinDmChatInitFeeRequest>,
serializer: some GRPCCore.MessageSerializer<Flipcash_Profile_V1_SetMinDmChatInitFeeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Flipcash_Profile_V1_SetMinDmChatInitFeeResponse>,
options: GRPCCore.CallOptions,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Flipcash_Profile_V1_SetMinDmChatInitFeeResponse>) async throws -> Result
) async throws -> Result where Result: Sendable

/// Call the "LinkSocialAccount" method.
///
/// > Source IDL Documentation:
Expand Down Expand Up @@ -480,6 +517,41 @@ extension Flipcash_Profile_V1_Profile {
)
}

/// Call the "SetMinDmChatInitFee" method.
///
/// > Source IDL Documentation:
/// >
/// > SetMinDmChatInitFee sets the minimum fee another user must pay to
/// > initialize a DM chat with the caller, replacing any fee already set.
///
/// - Parameters:
/// - request: A request containing a single `Flipcash_Profile_V1_SetMinDmChatInitFeeRequest` message.
/// - serializer: A serializer for `Flipcash_Profile_V1_SetMinDmChatInitFeeRequest` messages.
/// - deserializer: A deserializer for `Flipcash_Profile_V1_SetMinDmChatInitFeeResponse` messages.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func setMinDmChatInitFee<Result>(
request: GRPCCore.ClientRequest<Flipcash_Profile_V1_SetMinDmChatInitFeeRequest>,
serializer: some GRPCCore.MessageSerializer<Flipcash_Profile_V1_SetMinDmChatInitFeeRequest>,
deserializer: some GRPCCore.MessageDeserializer<Flipcash_Profile_V1_SetMinDmChatInitFeeResponse>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Flipcash_Profile_V1_SetMinDmChatInitFeeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.client.unary(
request: request,
descriptor: Flipcash_Profile_V1_Profile.Method.SetMinDmChatInitFee.descriptor,
serializer: serializer,
deserializer: deserializer,
options: options,
onResponse: handleResponse
)
}

/// Call the "LinkSocialAccount" method.
///
/// > Source IDL Documentation:
Expand Down Expand Up @@ -698,6 +770,36 @@ extension Flipcash_Profile_V1_Profile.ClientProtocol {
)
}

/// Call the "SetMinDmChatInitFee" method.
///
/// > Source IDL Documentation:
/// >
/// > SetMinDmChatInitFee sets the minimum fee another user must pay to
/// > initialize a DM chat with the caller, replacing any fee already set.
///
/// - Parameters:
/// - request: A request containing a single `Flipcash_Profile_V1_SetMinDmChatInitFeeRequest` message.
/// - options: Options to apply to this RPC.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func setMinDmChatInitFee<Result>(
request: GRPCCore.ClientRequest<Flipcash_Profile_V1_SetMinDmChatInitFeeRequest>,
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Flipcash_Profile_V1_SetMinDmChatInitFeeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
try await self.setMinDmChatInitFee(
request: request,
serializer: GRPCProtobuf.ProtobufSerializer<Flipcash_Profile_V1_SetMinDmChatInitFeeRequest>(),
deserializer: GRPCProtobuf.ProtobufDeserializer<Flipcash_Profile_V1_SetMinDmChatInitFeeResponse>(),
options: options,
onResponse: handleResponse
)
}

/// Call the "LinkSocialAccount" method.
///
/// > Source IDL Documentation:
Expand Down Expand Up @@ -925,6 +1027,40 @@ extension Flipcash_Profile_V1_Profile.ClientProtocol {
)
}

/// Call the "SetMinDmChatInitFee" method.
///
/// > Source IDL Documentation:
/// >
/// > SetMinDmChatInitFee sets the minimum fee another user must pay to
/// > initialize a DM chat with the caller, replacing any fee already set.
///
/// - Parameters:
/// - message: request message to send.
/// - metadata: Additional metadata to send, defaults to empty.
/// - options: Options to apply to this RPC, defaults to `.defaults`.
/// - handleResponse: A closure which handles the response, the result of which is
/// returned to the caller. Returning from the closure will cancel the RPC if it
/// hasn't already finished.
/// - Returns: The result of `handleResponse`.
public func setMinDmChatInitFee<Result>(
_ message: Flipcash_Profile_V1_SetMinDmChatInitFeeRequest,
metadata: GRPCCore.Metadata = [:],
options: GRPCCore.CallOptions = .defaults,
onResponse handleResponse: @Sendable @escaping (GRPCCore.ClientResponse<Flipcash_Profile_V1_SetMinDmChatInitFeeResponse>) async throws -> Result = { response in
try response.message
}
) async throws -> Result where Result: Sendable {
let request = GRPCCore.ClientRequest<Flipcash_Profile_V1_SetMinDmChatInitFeeRequest>(
message: message,
metadata: metadata
)
return try await self.setMinDmChatInitFee(
request: request,
options: options,
onResponse: handleResponse
)
}

/// Call the "LinkSocialAccount" method.
///
/// > Source IDL Documentation:
Expand Down
Loading
Loading