Skip to content

Commit

Permalink
Ensure optional parameters are hidden
Browse files Browse the repository at this point in the history
  • Loading branch information
MasterJ93 committed Jul 8, 2024
1 parent dc0ba29 commit ac917d5
Show file tree
Hide file tree
Showing 22 changed files with 64 additions and 62 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ extension ATProtoAdmin {
named name: String,
contentMarkdown: String,
subject: String,
createdBy: String?
createdBy: String? = nil
) async throws -> ToolsOzoneLexicon.Communication.TemplateViewDefinition {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ extension ATProtoAdmin {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func disableAccountInvites(
for accountDID: String,
note: String?
note: String? = nil
) async throws {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension ATProtoAdmin {
public func emitEvent(
_ event: ATUnion.EmitEventUnion,
subject: ATUnion.EmitEventSubjectUnion,
subjectBlobCIDHashes: [String]?,
subjectBlobCIDHashes: [String]? = nil,
createdBy: String
) async throws -> ToolsOzoneLexicon.Moderation.ModerationEventViewDefinition {
guard session != nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ extension ATProtoAdmin {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func enableAccountInvites(
for accountDID: String,
note: String?
note: String? = nil
) async throws {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension ATProtoAdmin {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func getRecord(
_ recordURI: String,
recordCID: String?
recordCID: String? = nil
) async throws -> Result<ToolsOzoneLexicon.Moderation.RecordViewDetailDefinition, Error> {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,25 +63,25 @@ extension ATProtoAdmin {
/// - Throws: An ``ATProtoError``-conforming error type, depending on the issue. Go to
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func queryStatuses(
_ subject: String?,
comment: String?,
reportedAfter: Date?,
reportedBefore: Date?,
reviewedAfter: Date?,
reviewedBefore: Date?,
_ subject: String? = nil,
comment: String? = nil,
reportedAfter: Date? = nil,
reportedBefore: Date? = nil,
reviewedAfter: Date? = nil,
reviewedBefore: Date? = nil,
shouldIncludeMuted: Bool? = false,
isOnlyMuted: Bool?,
reviewState: String?,
ignoreSubjects: [String]?,
lastReviewedBy: String?,
isOnlyMuted: Bool? = nil,
reviewState: String? = nil,
ignoreSubjects: [String]? = nil,
lastReviewedBy: String? = nil,
sortField: ToolsOzoneLexicon.Moderation.QueryStatuses.SortField? = .lastReportedAt,
sortDirection: ToolsOzoneLexicon.Moderation.QueryStatuses.SortDirection? = .descending,
isTakenDown: Bool?,
isAppealed: Bool?,
isTakenDown: Bool? = nil,
isAppealed: Bool? = nil,
limit: Int? = 50,
tags: [String]?,
excludeTags: [String]?,
cursor: String?
tags: [String]? = nil,
excludeTags: [String]? = nil,
cursor: String? = nil
) async throws -> Result<ToolsOzoneLexicon.Moderation.QueryStatusesOutput, Error> {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ extension ATProtoAdmin {
/// - Throws: An ``ATProtoError``-conforming error type, depending on the issue. Go to
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func searchAccounts(
by email: String?,
by email: String? = nil,
cursor: String? = nil,
limit: Int? = 50
) async throws -> Result<ComAtprotoLexicon.Admin.SearchAccountsOutput, Error> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension ATProtoAdmin {
/// - Throws: An ``ATProtoError``-conforming error type, depending on the issue. Go to
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func searchRepositories(
_ query: String?,
_ query: String? = nil,
withLimitOf limit: Int? = 50,
cursor: String?
) async throws -> Result<ComAtprotoLexicon.Admin.SearchRepositoriesOutput, Error> {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,10 +35,10 @@ extension ATProtoAdmin {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func sendEmail(
to recipientDID: String,
withSubjectLine subjectLine: String?,
withSubjectLine subjectLine: String? = nil,
content: String,
senderDID: String,
comment: String?
comment: String? = nil
) async throws -> Result<ComAtprotoLexicon.Admin.SendEmailOutput, Error> {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,11 +37,11 @@ extension ATProtoKit {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func updateCommunicationTemplate(
_ id: String,
name: String?,
contentMarkdown: String?,
subject: String?,
updatedBy: String?,
isDisabled: Bool?
name: String? = nil,
contentMarkdown: String? = nil,
subject: String? = nil,
updatedBy: String? = nil,
isDisabled: Bool? = nil
) async throws -> Result<ToolsOzoneLexicon.Communication.TemplateViewDefinition, Error> {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@ extension ATProtoAdmin {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func updateSubjectStatusAsAdmin(
_ subject: ATUnion.AdminUpdateSubjectStatusUnion,
takedown: ComAtprotoLexicon.Admin.StatusAttributesDefinition?,
deactivated: ComAtprotoLexicon.Admin.StatusAttributesDefinition?
takedown: ComAtprotoLexicon.Admin.StatusAttributesDefinition? = nil,
deactivated: ComAtprotoLexicon.Admin.StatusAttributesDefinition? = nil
) async throws -> Result<ComAtprotoLexicon.Admin.UpdateSubjectStatusOutput, Error> {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,19 @@ import Foundation
extension ATProtoKit {

/// Gets information about a given feed generator.
///
///
/// - Note: According to the AT Protocol specifications: "Get information about a
/// feed generator, including policies and offered feed URIs. Does not require auth;
/// implemented by Feed Generator services (not App View)."
///
///
/// - SeeAlso: This is based on the [`app.bsky.feed.describeFeedGenerator`][github] lexicon.
///
///
/// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/feed/describeFeedGenerator.json
///
///
/// - Parameter pdsURL: The URL of the Personal Data Server (PDS). Optional.
/// - Returns:The details of a feed generator, including its decentralized identifier (DID),
/// feed URIs, and policy information.
///
///
/// - Throws: An ``ATProtoError``-conforming error type, depending on the issue. Go to
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func describeFeedGenerator(pdsURL: String? = nil) async throws -> AppBskyLexicon.Feed.DescribeFeedGeneratorOutput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,20 @@ import Foundation
extension ATProtoKit {

/// Retrieves an array of tagged feeds and users.
///
///
/// - Important: This is an unspecced method, and as such, this is highly volatile and may
/// change or be removed at any time. Use at your own risk.
///
///
/// - Note: According to the AT Protocol specifications: "Get a list of suggestions (feeds and
/// users) tagged with categories."
///
///
/// - SeeAlso: This is based on the [`app.bsky.unspecced.getTaggedSuggestions`][github] lexicon.
///
///
/// [github]: https://github.com/bluesky-social/atproto/blob/main/lexicons/app/bsky/unspecced/getTaggedSuggestions.json
///
///
/// - Parameter pdsURL: The URL of the Personal Data Server (PDS). Optional.
/// - Returns: An array of suggestions.
///
///
/// - Throws: An ``ATProtoError``-conforming error type, depending on the issue. Go to
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func getTaggedSuggestions(pdsURL: String? = nil) async throws -> AppBskyLexicon.Unspecced.GetTaggedSuggestionsOutput {
Expand Down
12 changes: 6 additions & 6 deletions Sources/ATProtoKit/APIReference/AppBskyAPI/SearchPosts.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,14 @@ extension ATProtoKit {
public func searchPosts(
with searchQuery: String,
sortRanking: AppBskyLexicon.Feed.SearchPosts.SortRanking? = .latest,
sinceDate: Date?,
untilDate: Date?,
sinceDate: Date? = nil,
untilDate: Date? = nil,
mentionIdentifier: String? = nil,
author: String? = nil,
language: Locale?,
domain: String?,
url: String?,
tags: [String]?,
language: Locale? = nil,
domain: String? = nil,
url: String? = nil,
tags: [String]? = nil,
limit: Int? = 25,
cursor: String? = nil
) async throws -> AppBskyLexicon.Feed.SearchPostsOutput {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,14 @@ extension ATProtoKit {
public func searchPostsSkeleton(
with searchQuery: String,
sortRanking: AppBskyLexicon.Unspecced.SearchPostsSkeleton.Sort? = .latest,
sinceDate: Date?,
untilDate: Date?,
sinceDate: Date? = nil,
untilDate: Date? = nil,
mentionIdentifier: String? = nil,
author: String? = nil,
language: Locale?,
domain: String?,
url: String?,
tags: [String]?,
language: Locale? = nil,
domain: String? = nil,
url: String? = nil,
tags: [String]? = nil,
limit: Int? = 25,
cursor: String? = nil,
pdsURL: String? = nil
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension ATProtoBlueskyChat {
/// - Throws: An ``ATProtoError``-conforming error type, depending on the issue. Go to
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func getMessageContext(
from conversationID: String?,
from conversationID: String? = nil,
messageID: String,
messagesBefore: Int? = 5,
messagesAfter: Int? = 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ extension ATProtoBlueskyChat {
public func updateActorAccess(
actorDID: String,
doesAllowAccess: Bool,
reference: String?
reference: String? = nil
) async throws {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ extension ATProtoKit {
_ repositoryDID: String,
shouldValidate: Bool? = true,
writes: [ATUnion.ApplyWritesUnion],
swapCommit: String?
swapCommit: String? = nil
) async throws {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ extension ATProtoKit {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func createAppPassword(
named passwordName: String,
isPrivileged: Bool?
isPrivileged: Bool? = nil
) async throws -> Result<ComAtprotoLexicon.Server.CreateAppPasswordOutput, Error> {
guard session != nil,
let accessToken = session?.accessToken else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ extension ATProtoAdmin {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func createReport(
with reasonType: ComAtprotoLexicon.Moderation.ReasonTypeDefinition,
withContextof reason: String?,
withContextof reason: String? = nil,
subject: ATUnion.CreateReportSubjectUnion
) async throws -> Result<ComAtprotoLexicon.Moderation.CreateReportOutput, Error> {
guard session != nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ extension ATProtoKit {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func queryLabels(
uriPatterns: [String],
sources: [String]?,
sources: [String]? = nil,
limit: Int? = 50,
cursor: String? = nil,
pdsURL: String? = nil,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ extension ATProtoKit {
/// ``ATAPIError`` and ``ATRequestPrepareError`` for more details.
public func signPLCOperation(
token: String,
rotationKeys: [String]?,
alsoKnownAs: [String]?,
rotationKeys: [String]? = nil,
alsoKnownAs: [String]? = nil,
verificationMethods: VerificationMethod?,
service: ATService?
) async throws -> Result<ComAtprotoLexicon.Identity.SignPLCOperationOutput, Error> {
Expand Down

0 comments on commit ac917d5

Please sign in to comment.