spezimockwebservice

A Spezi-based Swift Package to mock the interaction with a web service in a Spezi-based app.

https://github.com/stanfordspezi/spezimockwebservice

Science Score: 67.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
    Found CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
    Found 3 DOI reference(s) in README
  • Academic publication links
    Links to: zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (9.7%) to scientific vocabulary
Last synced: 6 months ago · JSON representation ·

Repository

A Spezi-based Swift Package to mock the interaction with a web service in a Spezi-based app.

Basic Info
Statistics
  • Stars: 3
  • Watchers: 10
  • Forks: 1
  • Open Issues: 5
  • Releases: 7
Created over 2 years ago · Last pushed about 2 years ago
Metadata Files
Readme License Citation

README.md

SpeziMockWebService

Build and Test codecov DOI

Mock the interaction with a web service in a Spezi-based application.

Overview

The Spezi Mock Web Service Swift Package provides a Spezi Module (MockWebService) to mock the interaction with a web service and display the requests in a user interface that can be used for demonstrations and debugging purposes (RequestList).

| Screenshot showing an empty list with a placeholder stating: 'The Mock Web Service will display all requests that would be triggered by the application.' Screenshot showing an empty list with a placeholder stating: 'The Mock Web Service will display all requests that would be triggered by the application.' | Screenshot showing two requests in the mock request list: One is a deletion request, and one is an addition. Screenshot showing two requests in the mock request list: One is a deletion request, and one is an addition. | Detail view of a mock request, showing that it is an addition with a short JSON body. Detail view of a mock request, showing that it is an addition with a short JSON body. | |:---:|:---:|:---:| | The landing page of the RequestList | The RequestList provides an overview of all sent requests. | The detail view of a single request. |

Setup

1. Add Spezi Mock Web Service as a Dependency

You need to add the Spezi Mock Web Service Swift package to your app in Xcode or Swift package.

[!IMPORTANT]
If your application is not yet configured to use Spezi, follow the Spezi setup article setup the core Spezi infrastructure.

2. Register the Module

The MockWebService module needs to be registered in a Spezi-based application using the configuration in a SpeziAppDelegate: swift class ExampleAppDelegate: SpeziAppDelegate { override var configuration: Configuration { Configuration { MockWebService() // ... } } }

[!NOTE]
You can learn more about a Module in the Spezi documentation.

Example

The following example demonstrates the usage of the Swift Package in a SwiftUI View, accessing the MockWebService using the @Environment property wrapper.

```swift import SpeziMockWebService import SwiftUI

struct ExampleView: View { @Environment(MockWebService.self) var webService: MockWebService

var body: some View {
    NavigationStack {
        RequestList()
        // ...
    }
}


private func sendMockUploadRequests() async throws {
    try await webService.upload(path: "Test", body: #"{"test": "test"}"#)
    try await webService.remove(path: "TestRemoval")
}

} ```

For more information, please refer to the API documentation.

Contributing

Contributions to this project are welcome. Please make sure to read the contribution guidelines and the contributor covenant code of conduct first.

License

This project is licensed under the MIT License. See Licenses for more information.

Spezi Footer Spezi Footer

Owner

  • Name: Stanford Spezi
  • Login: StanfordSpezi
  • Kind: organization

Citation (CITATION.cff)

#
# This source file is part of the Stanford Spezi open source project
#
# SPDX-FileCopyrightText: 2022 Stanford University and the project authors (see CONTRIBUTORS.md)
#
# SPDX-License-Identifier: MIT
# 

cff-version: 1.2.0
message: "If you use this software, please cite it as below."
authors:
- family-names: "Schmiedmayer"
  given-names: "Paul"
  orcid: "https://orcid.org/0000-0002-8607-9148"
title: "SpeziMockWebService"
doi: 10.5281/zenodo.8239945
url: "https://github.com/StanfordSpezi/SpeziMockWebService"

GitHub Events

Total
  • Issues event: 1
Last Year
  • Issues event: 1

Issues and Pull Requests

Last synced: over 1 year ago

All Time
  • Total issues: 6
  • Total pull requests: 10
  • Average time to close issues: 2 months
  • Average time to close pull requests: about 1 hour
  • Total issue authors: 1
  • Total pull request authors: 3
  • Average comments per issue: 0.5
  • Average comments per pull request: 0.9
  • Merged pull requests: 10
  • Bot issues: 0
  • Bot pull requests: 0
Past Year
  • Issues: 1
  • Pull requests: 1
  • Average time to close issues: N/A
  • Average time to close pull requests: 7 minutes
  • Issue authors: 1
  • Pull request authors: 1
  • Average comments per issue: 0.0
  • Average comments per pull request: 1.0
  • Merged pull requests: 1
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • PSchmiedmayer (5)
Pull Request Authors
  • PSchmiedmayer (5)
  • Supereg (4)
  • vishnuravi (1)
Top Labels
Issue Labels
good first issue (4) help wanted (4) enhancement (4) documentation (1)
Pull Request Labels
enhancement (3) documentation (3)

Packages

  • Total packages: 1
  • Total downloads: unknown
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 7
swiftpackageindex.com: github.com/StanfordSpezi/SpeziMockWebService

A Spezi-based Swift Package to mock the interaction with a web service in a Spezi-based app.

  • Versions: 7
  • Dependent Packages: 0
  • Dependent Repositories: 1
Rankings
Dependent repos count: 14.3%
Dependent packages count: 16.7%
Average: 44.4%
Forks count: 60.3%
Stargazers count: 86.1%
Last synced: 6 months ago

Dependencies

.github/workflows/build-and-test.yml actions
.github/workflows/pull_request.yml actions
Package.swift swiftpm