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

Update API Interactions & Improve API Key Handling #23

Merged
merged 3 commits into from
May 25, 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
7 changes: 6 additions & 1 deletion NCIClinicalTrialsSearchAPI.json
Original file line number Diff line number Diff line change
Expand Up @@ -1558,8 +1558,13 @@
"description": "Text to be searched in multiple fields. It can be combined with <code>keyword_field</code>.<br><br><code>keyword</code> filter results by examining a variety of text-based fields <i>(By default: &#42;_id, other_ids.value, diseases.name._fulltext, diseases.synonyms._fulltext, brief_title, brief_summary, official_title, detail_description, official_title, brief_title, brief_summary, diseases.name._fulltext, detail_description, sites.org_name._fulltext, collaborators.name._fulltext, principal_investigator._fulltext, sites.contact_name._fulltext, sites.org_city._fulltext, sites.org_state_or_province._fulltext, arms.interventions.name, arms.interventions.synonyms, biomarkers.name, biomarkers.synonyms, prior_therapy.name, prior_therapy.synonyms)</i>.<br><br>Mutiple <code>keyword</code>s (with a maximum of 10 allowed) will give you an OR condition of between values in all configured fields.",
"required": false,
"schema": {
"type": "string"
"type": "array",
"items": {
"type": "string"
}
},
"style": "form",
"explode": true,
"examples": {
"": {
"value": ""
Expand Down
2 changes: 1 addition & 1 deletion NCIClinicalTrialsSearchAPI/.openapi-generator/VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
7.3.0
7.5.0
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public struct APIHelper {
if destination.isEmpty {
return nil
}
return destination
return destination.sorted { $0.name < $1.name }
}

/// maps all values from source to query parameters
Expand All @@ -114,6 +114,6 @@ public struct APIHelper {
if destination.isEmpty {
return nil
}
return destination
return destination.sorted { $0.name < $1.name }
}
}

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ import Foundation
#if !os(macOS)
import MobileCoreServices
#endif
#if canImport(UniformTypeIdentifiers)
import UniformTypeIdentifiers
#endif

public protocol URLSessionProtocol {
func dataTask(with request: URLRequest, completionHandler: @escaping @Sendable (Data?, URLResponse?, Error?) -> Void) -> URLSessionDataTask
Expand Down Expand Up @@ -560,9 +563,20 @@ private class FormDataEncoding: ParameterEncoding {
func mimeType(for url: URL) -> String {
let pathExtension = url.pathExtension

if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
return mimetype as String
if #available(iOS 15, macOS 11, *) {
#if canImport(UniformTypeIdentifiers)
if let utType = UTType(filenameExtension: pathExtension) {
return utType.preferredMIMEType ?? "application/octet-stream"
}
#else
return "application/octet-stream"
#endif
} else {
if let uti = UTTypeCreatePreferredIdentifierForTag(kUTTagClassFilenameExtension, pathExtension as NSString, nil)?.takeRetainedValue(),
let mimetype = UTTypeCopyPreferredTagWithClass(uti, kUTTagClassMIMEType)?.takeRetainedValue() {
return mimetype as String
}
return "application/octet-stream"
}
return "application/octet-stream"
}
Expand Down
1 change: 1 addition & 0 deletions NCIClinicalTrialsSearchAPI/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ This API client was generated by the [OpenAPI Generator](https://openapi-generat

- API version: 2.1.0
- Package version:
- Generator version: 7.5.0
- Build package: org.openapitools.codegen.languages.Swift5ClientCodegen

## Installation
Expand Down
6 changes: 3 additions & 3 deletions NCIClinicalTrialsSearchAPI/docs/TrialsAPI.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Name | Type | Description | Notes

# **searchTrialsByGet**
```swift
open class func searchTrialsByGet(size: Int? = nil, from: Int? = nil, sort: String? = nil, order: String? = nil, missing: String? = nil, exists: String? = nil, include: String? = nil, exclude: String? = nil, export: String? = nil, email: String? = nil, filename: String? = nil, fulltext: String? = nil, fieldParamFulltext: String? = nil, trialids: String? = nil, trialIds: String? = nil, keyword: String? = nil, keywordField: String? = nil, aggField: String? = nil, aggName: String? = nil, aggMinCount: Int? = nil, sitesOrgNameFulltext: String? = nil, trialStatus: String? = nil, nciFunded: String? = nil, nciId: String? = nil, nctId: String? = nil, protocolId: String? = nil, ccrId: String? = nil, ctepId: String? = nil, dcpId: String? = nil, currentTrialStatus: String? = nil, phase: String? = nil, studyProtocolType: String? = nil, nciPrograms: String? = nil, briefTitle: String? = nil, briefSummary: String? = nil, officialTitle: String? = nil, primaryPurpose: String? = nil, acceptsHealthyVolunteersIndicator: String? = nil, eligibilityStructuredAcceptsHealthyVolunteers: Bool? = nil, acronym: String? = nil, amendmentDate: String? = nil, anatomicSites: String? = nil, armsDescription: String? = nil, armsName: String? = nil, armsType: String? = nil, armsInterventionsNciThesaurusConceptId: String? = nil, armsInterventionsDescription: String? = nil, armsInterventionsName: String? = nil, armsInterventionsType: String? = nil, armsInterventionsSynonyms: String? = nil, associatedStudiesStudyId: String? = nil, associatedStudiesStudyIdType: String? = nil, eligibilityStructuredGender: String? = nil, eligibilityStructuredMinAgeInYearsLte: Int? = nil, eligibilityStructuredMinAgeInYearsGte: Int? = nil, eligibilityStructuredMaxAgeInYearsLte: Int? = nil, eligibilityStructuredMaxAgeInYearsGte: Int? = nil, eligibilityStructuredMinAgeUnit: String? = nil, eligibilityStructuredMinAgeNumberLte: Int? = nil, eligibilityStructuredMinAgeNumberGte: Int? = nil, eligibilityStructuredMaxAgeUnit: String? = nil, eligibilityStructuredMaxAgeNumberLte: Int? = nil, eligibilityStructuredMaxAgeNumberGte: Int? = nil, currentTrialStatusDateLte: String? = nil, currentTrialStatusDateGte: String? = nil, recordVerificationDateLte: String? = nil, recordVerificationDateGte: String? = nil, sitesOrgCoordinatesLat: Double? = nil, sitesOrgCoordinatesLon: Double? = nil, sitesOrgCoordinatesDist: String? = nil, sitesContactEmail: String? = nil, sitesContactName: String? = nil, sitesContactNameAuto: String? = nil, sitesContactNameRaw: String? = nil, sitesContactPhone: String? = nil, sitesOrgAddressLine1: String? = nil, sitesOrgAddressLine2: String? = nil, sitesOrgCity: String? = nil, sitesOrgPostalCode: String? = nil, sitesOrgStateOrProvince: String? = nil, sitesOrgCountry: String? = nil, sitesOrgCountryRaw: String? = nil, sitesOrgEmail: String? = nil, sitesOrgFamily: String? = nil, sitesOrgFax: String? = nil, sitesOrgName: String? = nil, sitesOrgNameAuto: String? = nil, sitesOrgNameRaw: String? = nil, sitesOrgPhone: String? = nil, sitesRecruitmentStatus: String? = nil, sitesRecruitmentStatusDate: String? = nil, sitesRecruitmentStatusDateLte: String? = nil, sitesRecruitmentStatusDateGte: String? = nil, leadOrgCancerCenter: String? = nil, completion: @escaping (_ data: TrialResponse?, _ error: Error?) -> Void)
open class func searchTrialsByGet(size: Int? = nil, from: Int? = nil, sort: String? = nil, order: String? = nil, missing: String? = nil, exists: String? = nil, include: String? = nil, exclude: String? = nil, export: String? = nil, email: String? = nil, filename: String? = nil, fulltext: String? = nil, fieldParamFulltext: String? = nil, trialids: String? = nil, trialIds: String? = nil, keyword: [String]? = nil, keywordField: String? = nil, aggField: String? = nil, aggName: String? = nil, aggMinCount: Int? = nil, sitesOrgNameFulltext: String? = nil, trialStatus: String? = nil, nciFunded: String? = nil, nciId: String? = nil, nctId: String? = nil, protocolId: String? = nil, ccrId: String? = nil, ctepId: String? = nil, dcpId: String? = nil, currentTrialStatus: String? = nil, phase: String? = nil, studyProtocolType: String? = nil, nciPrograms: String? = nil, briefTitle: String? = nil, briefSummary: String? = nil, officialTitle: String? = nil, primaryPurpose: String? = nil, acceptsHealthyVolunteersIndicator: String? = nil, eligibilityStructuredAcceptsHealthyVolunteers: Bool? = nil, acronym: String? = nil, amendmentDate: String? = nil, anatomicSites: String? = nil, armsDescription: String? = nil, armsName: String? = nil, armsType: String? = nil, armsInterventionsNciThesaurusConceptId: String? = nil, armsInterventionsDescription: String? = nil, armsInterventionsName: String? = nil, armsInterventionsType: String? = nil, armsInterventionsSynonyms: String? = nil, associatedStudiesStudyId: String? = nil, associatedStudiesStudyIdType: String? = nil, eligibilityStructuredGender: String? = nil, eligibilityStructuredMinAgeInYearsLte: Int? = nil, eligibilityStructuredMinAgeInYearsGte: Int? = nil, eligibilityStructuredMaxAgeInYearsLte: Int? = nil, eligibilityStructuredMaxAgeInYearsGte: Int? = nil, eligibilityStructuredMinAgeUnit: String? = nil, eligibilityStructuredMinAgeNumberLte: Int? = nil, eligibilityStructuredMinAgeNumberGte: Int? = nil, eligibilityStructuredMaxAgeUnit: String? = nil, eligibilityStructuredMaxAgeNumberLte: Int? = nil, eligibilityStructuredMaxAgeNumberGte: Int? = nil, currentTrialStatusDateLte: String? = nil, currentTrialStatusDateGte: String? = nil, recordVerificationDateLte: String? = nil, recordVerificationDateGte: String? = nil, sitesOrgCoordinatesLat: Double? = nil, sitesOrgCoordinatesLon: Double? = nil, sitesOrgCoordinatesDist: String? = nil, sitesContactEmail: String? = nil, sitesContactName: String? = nil, sitesContactNameAuto: String? = nil, sitesContactNameRaw: String? = nil, sitesContactPhone: String? = nil, sitesOrgAddressLine1: String? = nil, sitesOrgAddressLine2: String? = nil, sitesOrgCity: String? = nil, sitesOrgPostalCode: String? = nil, sitesOrgStateOrProvince: String? = nil, sitesOrgCountry: String? = nil, sitesOrgCountryRaw: String? = nil, sitesOrgEmail: String? = nil, sitesOrgFamily: String? = nil, sitesOrgFax: String? = nil, sitesOrgName: String? = nil, sitesOrgNameAuto: String? = nil, sitesOrgNameRaw: String? = nil, sitesOrgPhone: String? = nil, sitesRecruitmentStatus: String? = nil, sitesRecruitmentStatusDate: String? = nil, sitesRecruitmentStatusDateLte: String? = nil, sitesRecruitmentStatusDateGte: String? = nil, leadOrgCancerCenter: String? = nil, completion: @escaping (_ data: TrialResponse?, _ error: Error?) -> Void)
```

Search Trials by GET
Expand All @@ -88,7 +88,7 @@ let fulltext = "fulltext_example" // String | DEPRECATED. Use <code>keyword</cod
let fieldParamFulltext = "fieldParamFulltext_example" // String | DEPRECATED. Use <code><field_param>._fulltext</code> where available, described above. (optional)
let trialids = "trialids_example" // String | DEPRECATED. Use <code>trial_ids</code> instead. (optional)
let trialIds = "" // String | Filter results by examining trial identifiers (ccr_id, ctep_id, dcp_id, nci_id, nct_id, other_ids.value, protocol_id). Example: trials?trial_ids=nci-2011&trial_ids=NCT00 (optional)
let keyword = "" // String | Text to be searched in multiple fields. It can be combined with <code>keyword_field</code>.<br><br><code>keyword</code> filter results by examining a variety of text-based fields <i>(By default: &#42;_id, other_ids.value, diseases.name._fulltext, diseases.synonyms._fulltext, brief_title, brief_summary, official_title, detail_description, official_title, brief_title, brief_summary, diseases.name._fulltext, detail_description, sites.org_name._fulltext, collaborators.name._fulltext, principal_investigator._fulltext, sites.contact_name._fulltext, sites.org_city._fulltext, sites.org_state_or_province._fulltext, arms.interventions.name, arms.interventions.synonyms, biomarkers.name, biomarkers.synonyms, prior_therapy.name, prior_therapy.synonyms)</i>.<br><br>Mutiple <code>keyword</code>s (with a maximum of 10 allowed) will give you an OR condition of between values in all configured fields. (optional)
let keyword = ["inner_example"] // [String] | Text to be searched in multiple fields. It can be combined with <code>keyword_field</code>.<br><br><code>keyword</code> filter results by examining a variety of text-based fields <i>(By default: &#42;_id, other_ids.value, diseases.name._fulltext, diseases.synonyms._fulltext, brief_title, brief_summary, official_title, detail_description, official_title, brief_title, brief_summary, diseases.name._fulltext, detail_description, sites.org_name._fulltext, collaborators.name._fulltext, principal_investigator._fulltext, sites.contact_name._fulltext, sites.org_city._fulltext, sites.org_state_or_province._fulltext, arms.interventions.name, arms.interventions.synonyms, biomarkers.name, biomarkers.synonyms, prior_therapy.name, prior_therapy.synonyms)</i>.<br><br>Mutiple <code>keyword</code>s (with a maximum of 10 allowed) will give you an OR condition of between values in all configured fields. (optional)
let keywordField = "" // String | Field(s) to be searched for the text provided in <code>keyword</code>. Use multiple times; once for each field to be searched. For example:<br><code>keyword_field=brief_title._fulltext&keyword_field=lead_org._auto</code>. Use <code>keyword_field</code> to override the default fields used by <code>keyword</code>. A maximum of 10 fields is currently allowed. (optional)
let aggField = "" // String | Field to be used for aggregation. (optional)
let aggName = "" // String | Filter aggregation (use with <b>agg_field</b>). Autocomplete of this value must match the value of the field in <b>agg_field</b>. (optional)
Expand Down Expand Up @@ -200,7 +200,7 @@ Name | Type | Description | Notes
**fieldParamFulltext** | **String** | DEPRECATED. Use &lt;code&gt;&lt;field_param&gt;._fulltext&lt;/code&gt; where available, described above. | [optional]
**trialids** | **String** | DEPRECATED. Use &lt;code&gt;trial_ids&lt;/code&gt; instead. | [optional]
**trialIds** | **String** | Filter results by examining trial identifiers (ccr_id, ctep_id, dcp_id, nci_id, nct_id, other_ids.value, protocol_id). Example: trials?trial_ids&#x3D;nci-2011&amp;trial_ids&#x3D;NCT00 | [optional]
**keyword** | **String** | Text to be searched in multiple fields. It can be combined with &lt;code&gt;keyword_field&lt;/code&gt;.&lt;br&gt;&lt;br&gt;&lt;code&gt;keyword&lt;/code&gt; filter results by examining a variety of text-based fields &lt;i&gt;(By default: &amp;#42;_id, other_ids.value, diseases.name._fulltext, diseases.synonyms._fulltext, brief_title, brief_summary, official_title, detail_description, official_title, brief_title, brief_summary, diseases.name._fulltext, detail_description, sites.org_name._fulltext, collaborators.name._fulltext, principal_investigator._fulltext, sites.contact_name._fulltext, sites.org_city._fulltext, sites.org_state_or_province._fulltext, arms.interventions.name, arms.interventions.synonyms, biomarkers.name, biomarkers.synonyms, prior_therapy.name, prior_therapy.synonyms)&lt;/i&gt;.&lt;br&gt;&lt;br&gt;Mutiple &lt;code&gt;keyword&lt;/code&gt;s (with a maximum of 10 allowed) will give you an OR condition of between values in all configured fields. | [optional]
**keyword** | **[String]** | Text to be searched in multiple fields. It can be combined with &lt;code&gt;keyword_field&lt;/code&gt;.&lt;br&gt;&lt;br&gt;&lt;code&gt;keyword&lt;/code&gt; filter results by examining a variety of text-based fields &lt;i&gt;(By default: &amp;#42;_id, other_ids.value, diseases.name._fulltext, diseases.synonyms._fulltext, brief_title, brief_summary, official_title, detail_description, official_title, brief_title, brief_summary, diseases.name._fulltext, detail_description, sites.org_name._fulltext, collaborators.name._fulltext, principal_investigator._fulltext, sites.contact_name._fulltext, sites.org_city._fulltext, sites.org_state_or_province._fulltext, arms.interventions.name, arms.interventions.synonyms, biomarkers.name, biomarkers.synonyms, prior_therapy.name, prior_therapy.synonyms)&lt;/i&gt;.&lt;br&gt;&lt;br&gt;Mutiple &lt;code&gt;keyword&lt;/code&gt;s (with a maximum of 10 allowed) will give you an OR condition of between values in all configured fields. | [optional]
**keywordField** | **String** | Field(s) to be searched for the text provided in &lt;code&gt;keyword&lt;/code&gt;. Use multiple times; once for each field to be searched. For example:&lt;br&gt;&lt;code&gt;keyword_field&#x3D;brief_title._fulltext&amp;keyword_field&#x3D;lead_org._auto&lt;/code&gt;. Use &lt;code&gt;keyword_field&lt;/code&gt; to override the default fields used by &lt;code&gt;keyword&lt;/code&gt;. A maximum of 10 fields is currently allowed. | [optional]
**aggField** | **String** | Field to be used for aggregation. | [optional]
**aggName** | **String** | Filter aggregation (use with &lt;b&gt;agg_field&lt;/b&gt;). Autocomplete of this value must match the value of the field in &lt;b&gt;agg_field&lt;/b&gt;. | [optional]
Expand Down
Loading
Loading