Skip to content

Commit

Permalink
fix DiscordClient overlapping functions
Browse files Browse the repository at this point in the history
  • Loading branch information
MahdiBM committed Nov 8, 2022
1 parent 0e42c40 commit d722270
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 11 deletions.
2 changes: 1 addition & 1 deletion Sources/DiscordBM/DefaultDiscordClient.swift
Expand Up @@ -282,7 +282,7 @@ public struct DefaultDiscordClient: DiscordClient {
}
}

public func send<E: MultipartEncodable>(
public func sendMultipart<E: MultipartEncodable>(
to endpoint: Endpoint,
queries: [(String, String?)],
headers: HTTPHeaders,
Expand Down
20 changes: 10 additions & 10 deletions Sources/DiscordBM/DiscordClient.swift
Expand Up @@ -32,14 +32,14 @@ public protocol DiscordClient {
payload: E
) async throws -> DiscordClientResponse<C>

func send<E: MultipartEncodable>(
func sendMultipart<E: MultipartEncodable>(
to endpoint: Endpoint,
queries: [(String, String?)],
headers: HTTPHeaders,
payload: E
) async throws -> DiscordHTTPResponse

func send<E: MultipartEncodable, C: Codable>(
func sendMultipart<E: MultipartEncodable, C: Codable>(
to endpoint: Endpoint,
queries: [(String, String?)],
headers: HTTPHeaders,
Expand Down Expand Up @@ -76,13 +76,13 @@ public extension DiscordClient {
}

@inlinable
func send<E: MultipartEncodable, C: Codable>(
func sendMultipart<E: MultipartEncodable, C: Codable>(
to endpoint: Endpoint,
queries: [(String, String?)],
headers: HTTPHeaders,
payload: E
) async throws -> DiscordClientResponse<C> {
let response = try await self.send(
let response = try await self.sendMultipart(
to: endpoint,
queries: queries,
headers: headers,
Expand Down Expand Up @@ -255,7 +255,7 @@ public extension DiscordClient {
payload: InteractionResponse
) async throws -> DiscordClientResponse<InteractionResponse.CallbackData> {
let endpoint = Endpoint.createInteractionResponse(id: id, token: token)
return try await self.send(to: endpoint, queries: [], headers: [:], payload: payload)
return try await self.sendMultipart(to: endpoint, queries: [], headers: [:], payload: payload)
}

/// https://discord.com/developers/docs/interactions/receiving-and-responding#edit-original-interaction-response
Expand All @@ -269,7 +269,7 @@ public extension DiscordClient {
appId: try requireAppId(appId),
token: token
)
return try await self.send(to: endpoint, queries: [], headers: [:], payload: payload)
return try await self.sendMultipart(to: endpoint, queries: [], headers: [:], payload: payload)
}

/// https://discord.com/developers/docs/interactions/receiving-and-responding#delete-original-interaction-response
Expand All @@ -296,7 +296,7 @@ public extension DiscordClient {
appId: try requireAppId(appId),
token: token
)
return try await self.send(to: endpoint, queries: [], headers: [:], payload: payload)
return try await self.sendMultipart(to: endpoint, queries: [], headers: [:], payload: payload)
}

/// https://discord.com/developers/docs/interactions/receiving-and-responding#edit-followup-message
Expand All @@ -312,7 +312,7 @@ public extension DiscordClient {
id: id,
token: token
)
return try await self.send(to: endpoint, queries: [], headers: [:], payload: payload)
return try await self.sendMultipart(to: endpoint, queries: [], headers: [:], payload: payload)
}

/// https://discord.com/developers/docs/resources/channel#create-message
Expand All @@ -322,7 +322,7 @@ public extension DiscordClient {
payload: DiscordChannel.CreateMessage
) async throws -> DiscordClientResponse<DiscordChannel.Message> {
let endpoint = Endpoint.postCreateMessage(channelId: channelId)
return try await self.send(to: endpoint, queries: [], headers: [:], payload: payload)
return try await self.sendMultipart(to: endpoint, queries: [], headers: [:], payload: payload)
}

/// https://discord.com/developers/docs/resources/channel#edit-message
Expand All @@ -333,7 +333,7 @@ public extension DiscordClient {
payload: DiscordChannel.EditMessage
) async throws -> DiscordClientResponse<DiscordChannel.Message> {
let endpoint = Endpoint.patchEditMessage(channelId: channelId, messageId: messageId)
return try await self.send(to: endpoint, queries: [], headers: [:], payload: payload)
return try await self.sendMultipart(to: endpoint, queries: [], headers: [:], payload: payload)
}

/// https://discord.com/developers/docs/resources/channel#delete-message
Expand Down

0 comments on commit d722270

Please sign in to comment.