Skip to content

Commit

Permalink
Prep for Release 1.9.0 (#53)
Browse files Browse the repository at this point in the history
* Create build-proto.yml
* Automatically build swift wrappers for the copied proto files
* Create README.md
* Update build-proto.yml
* Initial push of the proto files
* Action update
* Updated proto files
* New services
* Updated proto wrappers
* Reformat things
* Update build-proto.yml
* Update generate.bash
  • Loading branch information
fundthmcalculus authored Feb 6, 2023
1 parent ada24f9 commit 1afa954
Show file tree
Hide file tree
Showing 46 changed files with 6,123 additions and 2,012 deletions.
61 changes: 61 additions & 0 deletions .github/workflows/build-proto.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
name: Build Proto Files
on:
workflow_call:
workflow_dispatch:
push:
branches:
- main
paths:
- "proto/**"
pull_request:
paths:
- "proto/**"
- ".github/workflows/build-proto.yml"

jobs:
compile_proto:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ github.head_ref }}
submodules: recursive
- name: Install Protoc
uses: arduino/setup-protoc@v1
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Configure git credentials
uses: OleksiyRudenko/gha-git-credentials@v2
with:
token: '${{ secrets.GITHUB_TOKEN }}'

- uses: trinsic-id/protoc-gen-sdk@main
id: buildsdkwrappers
with:
protoPath: ${{github.workspace}}/proto
swiftPath: ${{github.workspace}}/Sources/Trinsic
- name: Compile proto files
run: ./generate.bash
shell: bash

- name: Commit changes
uses: EndBug/add-and-commit@v9
id: commit_changes
with:
author_name: Mewmba
author_email: [email protected]
message: 'Generated code from proto files on branch ${{ github.head_ref }}'
new_branch: 'mewmba-${{ github.head_ref }}-generated-protos'
push: '--force --set-upstream origin mewmba-${{ github.head_ref }}-generated-protos'

- name: pull-request
uses: repo-sync/pull-request@v2
if: ${{ steps.commit_changes.outputs.committed == 'true' }}
with:
source_branch: "mewmba-${{ github.head_ref }}-generated-protos" # From previous step
destination_branch: ${{ github.head_ref }}
pr_title: "Generated Protos for ${{ github.head_ref }}"
pr_body: ":rocket: Generated protos"
pr_allow_empty: false
github_token: ${{ secrets.GITHUB_TOKEN }}
48 changes: 48 additions & 0 deletions Sources/Trinsic/AccessManagementService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
//
// File.swift
//
//
// Created by Tomislav Markovski on 11/30/21.
//

import Foundation
import GRPC

public class AccessManagementService: ServiceBase {
var client: Services_Provider_V1_AccessManagementNIOClient?

public init() {
super.init(options: Sdk_Options_V1_ServiceOptions())
client = Services_Provider_V1_AccessManagementNIOClient(channel: createChannel())
}

override public init(options: Sdk_Options_V1_ServiceOptions) {
super.init(options: options)
client = Services_Provider_V1_AccessManagementNIOClient(channel: createChannel())
}

// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
// target: /Users/scott/Documents/GitHub/sdk-swift/Sources/Trinsic/AccessManagementService.swift

@available(*, deprecated, message: "This method is experimental")
public func addRoleAssignment(request: Services_Provider_V1_AddRoleAssignmentRequest) throws -> Services_Provider_V1_AddRoleAssignmentResponse {
try client!.AddRoleAssignment(request, callOptions: try buildMetadata(request))
.response
.wait()
}

@available(*, deprecated, message: "This method is experimental")
public func removeRoleAssignment(request: Services_Provider_V1_RemoveRoleAssignmentRequest) throws -> Services_Provider_V1_RemoveRoleAssignmentResponse {
try client!.RemoveRoleAssignment(request, callOptions: try buildMetadata(request))
.response
.wait()
}

@available(*, deprecated, message: "This method is experimental")
public func listRoleAssignments(request: Services_Provider_V1_ListRoleAssignmentsRequest) throws -> Services_Provider_V1_ListRoleAssignmentsResponse {
try client!.ListRoleAssignments(request, callOptions: try buildMetadata(request))
.response
.wait()
}
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
}
20 changes: 4 additions & 16 deletions Sources/Trinsic/AccountService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ public class AccountService: ServiceBase {

public func loginAnonymous(ecosystemId: String) throws -> String {
var loginRequest = Services_Account_V1_LoginRequest()
loginRequest.ecosystemID = ecosystemId;
loginRequest.ecosystemID = ecosystemId
let response = try login(request: loginRequest)
if response.profile.hasProtection, response.profile.protection.enabled {
throw SdkError.profileProtected
Expand All @@ -124,28 +124,16 @@ public class AccountService: ServiceBase {
}

// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
// target: C:\work\sdk-swift\Sources\Trinsic\AccountService.swift
// target: /Users/scott/Documents/GitHub/sdk-swift/Sources/Trinsic/AccountService.swift

public func info(request: Services_Account_V1_AccountInfoRequest) throws -> Services_Account_V1_AccountInfoResponse {
return try client!.Info(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func listDevices(request: Services_Account_V1_ListDevicesRequest) throws -> Services_Account_V1_ListDevicesResponse {
return try client!.ListDevices(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func revokeDevice(request: Services_Account_V1_RevokeDeviceRequest) throws -> Services_Account_V1_RevokeDeviceResponse {
return try client!.RevokeDevice(request, callOptions: try buildMetadata(request))
try client!.Info(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func authorizeWebhook(request: Services_Account_V1_AuthorizeWebhookRequest) throws -> Services_Account_V1_AuthorizeWebhookResponse {
return try client!.AuthorizeWebhook(request, callOptions: try buildMetadata(request))
try client!.AuthorizeWebhook(request, callOptions: try buildMetadata(request))
.response
.wait()
}
Expand Down
17 changes: 9 additions & 8 deletions Sources/Trinsic/CredentialService.swift
Original file line number Diff line number Diff line change
Expand Up @@ -22,46 +22,47 @@ public class CredentialService: ServiceBase {
}

// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
// target: C:\work\sdk-swift\Sources\Trinsic\CredentialService.swift
// target: /Users/scott/Documents/GitHub/sdk-swift/Sources/Trinsic/CredentialService.swift

@available(*, deprecated, message: "This endpoint will be removed around May 1, 2023")
public func issue(request: Services_Verifiablecredentials_V1_IssueRequest) throws -> Services_Verifiablecredentials_V1_IssueResponse {
return try client!.Issue(request, callOptions: try buildMetadata(request))
try client!.Issue(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func issueFromTemplate(request: Services_Verifiablecredentials_V1_IssueFromTemplateRequest) throws -> Services_Verifiablecredentials_V1_IssueFromTemplateResponse {
return try client!.IssueFromTemplate(request, callOptions: try buildMetadata(request))
try client!.IssueFromTemplate(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func checkStatus(request: Services_Verifiablecredentials_V1_CheckStatusRequest) throws -> Services_Verifiablecredentials_V1_CheckStatusResponse {
return try client!.CheckStatus(request, callOptions: try buildMetadata(request))
try client!.CheckStatus(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func updateStatus(request: Services_Verifiablecredentials_V1_UpdateStatusRequest) throws -> Services_Verifiablecredentials_V1_UpdateStatusResponse {
return try client!.UpdateStatus(request, callOptions: try buildMetadata(request))
try client!.UpdateStatus(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func createProof(request: Services_Verifiablecredentials_V1_CreateProofRequest) throws -> Services_Verifiablecredentials_V1_CreateProofResponse {
return try client!.CreateProof(request, callOptions: try buildMetadata(request))
try client!.CreateProof(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func verifyProof(request: Services_Verifiablecredentials_V1_VerifyProofRequest) throws -> Services_Verifiablecredentials_V1_VerifyProofResponse {
return try client!.VerifyProof(request, callOptions: try buildMetadata(request))
try client!.VerifyProof(request, callOptions: try buildMetadata(request))
.response
.wait()
}

public func send(request: Services_Verifiablecredentials_V1_SendRequest) throws -> Services_Verifiablecredentials_V1_SendResponse {
return try client!.Send(request, callOptions: try buildMetadata(request))
try client!.Send(request, callOptions: try buildMetadata(request))
.response
.wait()
}
Expand Down
2 changes: 1 addition & 1 deletion Sources/Trinsic/Extensions.swift
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import Foundation

extension Date {
var millisecondsSince1970: Int64 {
return Int64((timeIntervalSince1970 * 1000.0).rounded())
Int64((timeIntervalSince1970 * 1000.0).rounded())
}

init(milliseconds: Int) {
Expand Down
62 changes: 62 additions & 0 deletions Sources/Trinsic/FileManagementService.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
//
// File.swift
//
//
// Created by Tomislav Markovski on 11/30/21.
//

import Foundation
import GRPC

public class FileManagementService: ServiceBase {
var client: Services_Filemanagement_V1_FileManagementNIOClient?

public init() {
super.init(options: Sdk_Options_V1_ServiceOptions())
client = Services_Filemanagement_V1_FileManagementNIOClient(channel: createChannel())
}

override public init(options: Sdk_Options_V1_ServiceOptions) {
super.init(options: options)
client = Services_Filemanagement_V1_FileManagementNIOClient(channel: createChannel())
}

// BEGIN Code generated by protoc-gen-trinsic. DO NOT EDIT.
// target: /Users/scott/Documents/GitHub/sdk-swift/Sources/Trinsic/FileManagementService.swift

@available(*, deprecated, message: "This method is experimental")
public func uploadFile(request: Services_Filemanagement_V1_UploadFileRequest) throws -> Services_Filemanagement_V1_UploadFileResponse {
try client!.UploadFile(request, callOptions: try buildMetadata(request))
.response
.wait()
}

@available(*, deprecated, message: "This method is experimental")
public func getFile(request: Services_Filemanagement_V1_GetFileRequest) throws -> Services_Filemanagement_V1_GetFileResponse {
try client!.GetFile(request, callOptions: try buildMetadata(request))
.response
.wait()
}

@available(*, deprecated, message: "This method is experimental")
public func deleteFile(request: Services_Filemanagement_V1_DeleteFileRequest) throws -> Services_Filemanagement_V1_DeleteFileResponse {
try client!.DeleteFile(request, callOptions: try buildMetadata(request))
.response
.wait()
}

@available(*, deprecated, message: "This method is experimental")
public func listFiles(request: Services_Filemanagement_V1_ListFilesRequest) throws -> Services_Filemanagement_V1_ListFilesResponse {
try client!.ListFiles(request, callOptions: try buildMetadata(request))
.response
.wait()
}

@available(*, deprecated, message: "This method is experimental")
public func getStorageStats(request: Services_Filemanagement_V1_GetStorageStatsRequest) throws -> Services_Filemanagement_V1_GetStorageStatsResponse {
try client!.GetStorageStats(request, callOptions: try buildMetadata(request))
.response
.wait()
}
// END Code generated by protoc-gen-trinsic. DO NOT EDIT.
}
4 changes: 2 additions & 2 deletions Sources/Trinsic/Proto/pbmse/v1/pbmse.pb.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,12 +194,12 @@ public struct Pbmse_V1_EncryptionRecipient {
// methods supported on all messages.

public var header: Pbmse_V1_EncryptionHeader {
get { return _header ?? Pbmse_V1_EncryptionHeader() }
get { _header ?? Pbmse_V1_EncryptionHeader() }
set { _header = newValue }
}

/// Returns true if `header` has been explicitly set.
public var hasHeader: Bool { return _header != nil }
public var hasHeader: Bool { _header != nil }
/// Clears the value of `header`. Subsequent reads from it will return its default value.
public mutating func clearHeader() { _header = nil }

Expand Down
Loading

0 comments on commit 1afa954

Please sign in to comment.